Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache
@ 2008-09-13 23:58 John David Anglin
  2008-09-14  2:44 ` Randolph Chung
  0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2008-09-13 23:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: randolph

The main fix in this patch is to remove the pad increment of scptr.  As
far as I know, there is no pad field in the sigcontext struct between the
general registers and the floating point registers.

I also recorded the PSW and SAR registers.  It might be a mistake to record
the PSW value, but I believe the SAR register definitely needs to be recorded.

Somewhat tested on hppa-linux but the gdb testsuite crashes 2.6.19.22.

Ok?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2008-09-13  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Record
	HPPA_IPSW_REGNUM and HPPA_SAR_REGNUM values.  Remove pad increment.

Index: hppa-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v
retrieving revision 1.31
diff -u -3 -p -r1.31 hppa-linux-tdep.c
--- hppa-linux-tdep.c	21 Aug 2008 13:19:18 -0000	1.31
+++ hppa-linux-tdep.c	13 Sep 2008 22:51:35 -0000
@@ -227,7 +229,8 @@ hppa_linux_sigtramp_frame_unwind_cache (
   /* Skip sc_flags.  */
   scptr += 4;
 
-  /* GR[0] is the psw, we don't restore that.  */
+  /* GR[0] is the psw.  */
+  info->saved_regs[HPPA_IPSW_REGNUM].addr = scptr;
   scptr += 4;
 
   /* General registers.  */
@@ -237,9 +240,6 @@ hppa_linux_sigtramp_frame_unwind_cache (
       scptr += 4;
     }
 
-  /* Pad.  */
-  scptr += 4;
-
   /* FP regs; FP0-3 are not restored.  */
   scptr += (8 * 4);
 
@@ -262,6 +262,9 @@ hppa_linux_sigtramp_frame_unwind_cache (
   info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
   scptr += 4;
 
+  info->saved_regs[HPPA_SAR_REGNUM].addr = scptr;
+  scptr += 4;
+
   info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
 
   return info;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache
  2008-09-13 23:58 [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache John David Anglin
@ 2008-09-14  2:44 ` Randolph Chung
  2008-09-14  3:47   ` John David Anglin
  0 siblings, 1 reply; 4+ messages in thread
From: Randolph Chung @ 2008-09-14  2:44 UTC (permalink / raw)
  To: John David Anglin; +Cc: gdb-patches

Hrm, this worries me.

The sigcontext structure looks like this:

struct sigcontext {
    unsigned long sc_flags;
    unsigned long sc_gr[32];
    unsigned long long sc_fr[32];
    unsigned long sc_iasq[2];
    unsigned long sc_iaoq[2];
    unsigned long sc_sar;
};

I am positive that when I wrote this the structure got padded between
sc_gr and sc_fr to keep the unsigned long long at a 8-byte boundary.
If this has changed now that means we've introduced a silent ABI
change....

The SAR stuff looks ok. I'm not very sure about restoring the IPSW either.

randolph


On Sat, Sep 13, 2008 at 4:57 PM, John David Anglin
<dave@hiauly1.hia.nrc.ca> wrote:
> The main fix in this patch is to remove the pad increment of scptr.  As
> far as I know, there is no pad field in the sigcontext struct between the
> general registers and the floating point registers.
>
> I also recorded the PSW and SAR registers.  It might be a mistake to record
> the PSW value, but I believe the SAR register definitely needs to be recorded.
>
> Somewhat tested on hppa-linux but the gdb testsuite crashes 2.6.19.22.
>
> Ok?
>
> Dave
> --
> J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
> National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
>
> 2008-09-13  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
>
>        * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Record
>        HPPA_IPSW_REGNUM and HPPA_SAR_REGNUM values.  Remove pad increment.
>
> Index: hppa-linux-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v
> retrieving revision 1.31
> diff -u -3 -p -r1.31 hppa-linux-tdep.c
> --- hppa-linux-tdep.c   21 Aug 2008 13:19:18 -0000      1.31
> +++ hppa-linux-tdep.c   13 Sep 2008 22:51:35 -0000
> @@ -227,7 +229,8 @@ hppa_linux_sigtramp_frame_unwind_cache (
>   /* Skip sc_flags.  */
>   scptr += 4;
>
> -  /* GR[0] is the psw, we don't restore that.  */
> +  /* GR[0] is the psw.  */
> +  info->saved_regs[HPPA_IPSW_REGNUM].addr = scptr;
>   scptr += 4;
>
>   /* General registers.  */
> @@ -237,9 +240,6 @@ hppa_linux_sigtramp_frame_unwind_cache (
>       scptr += 4;
>     }
>
> -  /* Pad.  */
> -  scptr += 4;
> -
>   /* FP regs; FP0-3 are not restored.  */
>   scptr += (8 * 4);
>
> @@ -262,6 +262,9 @@ hppa_linux_sigtramp_frame_unwind_cache (
>   info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
>   scptr += 4;
>
> +  info->saved_regs[HPPA_SAR_REGNUM].addr = scptr;
> +  scptr += 4;
> +
>   info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
>
>   return info;
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache
  2008-09-14  2:44 ` Randolph Chung
@ 2008-09-14  3:47   ` John David Anglin
  0 siblings, 0 replies; 4+ messages in thread
From: John David Anglin @ 2008-09-14  3:47 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

> The sigcontext structure looks like this:
> 
> struct sigcontext {
>     unsigned long sc_flags;
>     unsigned long sc_gr[32];
>     unsigned long long sc_fr[32];
>     unsigned long sc_iasq[2];
>     unsigned long sc_iaoq[2];
>     unsigned long sc_sar;
> };
> 
> I am positive that when I wrote this the structure got padded between
> sc_gr and sc_fr to keep the unsigned long long at a 8-byte boundary.

No, you are correct.  The long long field will be aligned at an 8-byte
boundary.  I will keep the pad.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache
       [not found] <no.id>
@ 2008-09-15  2:24 ` John David Anglin
  0 siblings, 0 replies; 4+ messages in thread
From: John David Anglin @ 2008-09-15  2:24 UTC (permalink / raw)
  To: John David Anglin; +Cc: randolph, gdb-patches

> No, you are correct.  The long long field will be aligned at an 8-byte
> boundary.  I will keep the pad.

Committed the following after retesting.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2008-09-14  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Record
	HPPA_IPSW_REGNUM and HPPA_SAR_REGNUM values.

Index: hppa-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v
retrieving revision 1.32
diff -u -3 -p -r1.32 hppa-linux-tdep.c
--- hppa-linux-tdep.c	14 Sep 2008 14:08:42 -0000	1.32
+++ hppa-linux-tdep.c	15 Sep 2008 00:50:52 -0000
@@ -227,7 +227,8 @@ hppa_linux_sigtramp_frame_unwind_cache (
   /* Skip sc_flags.  */
   scptr += 4;
 
-  /* GR[0] is the psw, we don't restore that.  */
+  /* GR[0] is the psw.  */
+  info->saved_regs[HPPA_IPSW_REGNUM].addr = scptr;
   scptr += 4;
 
   /* General registers.  */
@@ -237,7 +238,7 @@ hppa_linux_sigtramp_frame_unwind_cache (
       scptr += 4;
     }
 
-  /* Pad.  */
+  /* Pad to long long boundary.  */
   scptr += 4;
 
   /* FP regs; FP0-3 are not restored.  */
@@ -262,6 +263,8 @@ hppa_linux_sigtramp_frame_unwind_cache (
   info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
   scptr += 4;
 
+  info->saved_regs[HPPA_SAR_REGNUM].addr = scptr;
+
   info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
 
   return info;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-15  2:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-13 23:58 [PATCH] Fix hppa_linux_sigtramp_frame_unwind_cache John David Anglin
2008-09-14  2:44 ` Randolph Chung
2008-09-14  3:47   ` John David Anglin
     [not found] <no.id>
2008-09-15  2:24 ` John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox