[hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Randolph Chung
The attached patch adds support for signal frame unwinding under
hppa64-hp-hpux11.11, and fixes a bug with signal frame unwinding under
hppa2.0w-hp-hpux11.11. I will commit this in a day or no if there are no
comments.

randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

2005-11-15  Randolph Chung  <[hidden email]>

        * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Ensure "off"
        is large enough to hold 64-bit offset.  Set proper signal context offset
        for 64-bit programs.  Set pc properly for signal frames.

Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.43
diff -u -p -r1.43 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
+++ hppa-hpux-tdep.c 15 Nov 2005 15:40:07 -0000
@@ -1158,8 +1158,8 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct hppa_hpux_sigtramp_unwind_cache *info;
   unsigned int flag;
-  CORE_ADDR sp, scptr;
-  int i, incr, off, szoff;
+  CORE_ADDR sp, scptr, off;
+  int i, incr, szoff;
 
   if (*this_cache)
     return *this_cache;
@@ -1170,14 +1170,18 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
 
   sp = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
 
-  scptr = sp - 1352;
+  if (IS_32BIT_TARGET (gdbarch))
+    scptr = sp - 1352;
+  else
+    scptr = sp - 1520;
+
   off = scptr;
 
   /* See /usr/include/machine/save_state.h for the structure of the save_state_t
      structure. */
   
   flag = read_memory_unsigned_integer(scptr, 4);
-    
+
   if (!(flag & 0x40))
     {
       /* Narrow registers. */
@@ -1188,7 +1192,7 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
   else
     {
       /* Wide registers. */
-      off = scptr + offsetof (save_state_t, ss_wide) + 8;
+      off = scptr + offsetof (save_state_t, ss_wide.ss_64) + 8;
       incr = 8;
       szoff = (tdep->bytes_per_address == 4 ? 4 : 0);
     }
@@ -1203,11 +1207,15 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
     {
       if (hppa_hpux_tramp_reg[i] > 0)
         info->saved_regs[hppa_hpux_tramp_reg[i]].addr = off + szoff;
+
       off += incr;
     }
 
   /* TODO: fp regs */
 
+  info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
+    info->saved_regs[HPPA_RP_REGNUM].addr;
+
   info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
 
   return info;
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Mark Kettenis
> Date: Thu, 17 Nov 2005 12:47:50 +0800
> From: Randolph Chung <[hidden email]>
>
> The attached patch adds support for signal frame unwinding under
> hppa64-hp-hpux11.11, and fixes a bug with signal frame unwinding under
> hppa2.0w-hp-hpux11.11. I will commit this in a day or no if there are no
> comments.
>
> 2005-11-15  Randolph Chung  <[hidden email]>
>
> * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Ensure "off"
> is large enough to hold 64-bit offset.  Set proper signal context offset
> for 64-bit programs.  Set pc properly for signal frames.

Please reformat the ChangeLog entry before you commit; the lines are too long!

> Index: hppa-hpux-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
> retrieving revision 1.43
> diff -u -p -r1.43 hppa-hpux-tdep.c
> --- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
> +++ hppa-hpux-tdep.c 15 Nov 2005 15:40:07 -0000
> @@ -1188,7 +1192,7 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
>    else
>      {
>        /* Wide registers. */
> -      off = scptr + offsetof (save_state_t, ss_wide) + 8;
> +      off = scptr + offsetof (save_state_t, ss_wide.ss_64) + 8;
>        incr = 8;
>        szoff = (tdep->bytes_per_address == 4 ? 4 : 0);
>      }
> @@ -1203,11 +1207,15 @@ hppa_hpux_sigtramp_frame_unwind_cache (s

Hmm, why is this chunk needed?  AFAICT it shouldn't make a difference
and I have a preference for using a plain ss_wide).

Mark
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Randolph Chung
>>2005-11-15  Randolph Chung  <[hidden email]>
>>
>> * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Ensure "off"
>> is large enough to hold 64-bit offset.  Set proper signal context offset
>> for 64-bit programs.  Set pc properly for signal frames.
>
>
> Please reformat the ChangeLog entry before you commit; the lines are too long!

I can, but these lines are only 80 characters wide... why are they too
long?

>>Index: hppa-hpux-tdep.c
>>===================================================================
>>RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
>>retrieving revision 1.43
>>diff -u -p -r1.43 hppa-hpux-tdep.c
>>--- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
>>+++ hppa-hpux-tdep.c 15 Nov 2005 15:40:07 -0000
>>@@ -1188,7 +1192,7 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
>>   else
>>     {
>>       /* Wide registers. */
>>-      off = scptr + offsetof (save_state_t, ss_wide) + 8;
>>+      off = scptr + offsetof (save_state_t, ss_wide.ss_64) + 8;
>>       incr = 8;
>>       szoff = (tdep->bytes_per_address == 4 ? 4 : 0);
>>     }
>>@@ -1203,11 +1207,15 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
>
>
> Hmm, why is this chunk needed?  AFAICT it shouldn't make a difference
> and I have a preference for using a plain ss_wide).

It's not needed, but it's a bit clearer IMO. I will revert this if you
prefer.

randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Mark Kettenis
> Date: Thu, 17 Nov 2005 18:04:40 +0800
> From: Randolph Chung <[hidden email]>
>
> >>2005-11-15  Randolph Chung  <[hidden email]>
> >>
> >> * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Ensure "off"
> >> is large enough to hold 64-bit offset.  Set proper signal context offset
> >> for 64-bit programs.  Set pc properly for signal frames.
> >
> >
> > Please reformat the ChangeLog entry before you commit; the lines are too long!
>
> I can, but these lines are only 80 characters wide... why are they too
> long?

Ah, 80 characters is too long.  Emacs will wrap the line if there's
something in column 80.  Please keep it down to something like 72.

> >>Index: hppa-hpux-tdep.c
> >>===================================================================
> >>RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
> >>retrieving revision 1.43
> >>diff -u -p -r1.43 hppa-hpux-tdep.c
> >>--- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
> >>+++ hppa-hpux-tdep.c 15 Nov 2005 15:40:07 -0000
> >>@@ -1188,7 +1192,7 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
> >>   else
> >>     {
> >>       /* Wide registers. */
> >>-      off = scptr + offsetof (save_state_t, ss_wide) + 8;
> >>+      off = scptr + offsetof (save_state_t, ss_wide.ss_64) + 8;
> >>       incr = 8;
> >>       szoff = (tdep->bytes_per_address == 4 ? 4 : 0);
> >>     }
> >>@@ -1203,11 +1207,15 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
> >
> >
> > Hmm, why is this chunk needed?  AFAICT it shouldn't make a difference
> > and I have a preference for using a plain ss_wide).
>
> It's not needed, but it's a bit clearer IMO. I will revert this if you
> prefer.

Actually what I'd really prefer if you'd make use of the
HPPA_HPUX_SS_XXX constants that I added when I did the HP-UX register
set support.  You'll need to move them to the start of the file, but
using them would bring us a step closer to building a HP-UX
cross-debugger.

But if you don't want to spend the time on this, then yes, I'd prefer
that you don't change ss_wide into ss_wide.ss_64.  The reason is
actually that even for 32-bit stuff the ss_wide part of save_state_t
might be used.  So I think the ss_64 part is misleading.

Mark
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Randolph Chung
Here's the new version.

randolph

2005-11-15  Randolph Chung  <[hidden email]>

        * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Use
        HPPA_HPUX_SS_* constants.  Ensure "off" is large enough to hold
        64-bit offset.  Set proper signal context offset for 64-bit
        programs.  Set pc properly for signal frames.

Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.43
diff -u -p -r1.43 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
+++ hppa-hpux-tdep.c 17 Nov 2005 12:13:28 -0000
@@ -49,6 +49,26 @@
 #define IS_32BIT_TARGET(_gdbarch) \
  ((gdbarch_tdep (_gdbarch))->bytes_per_address == 4)
 
+/* Bit in the `ss_flag' member of `struct save_state' that indicates
+   that the 64-bit register values are live.  From
+   <machine/save_state.h>.  */
+#define HPPA_HPUX_SS_WIDEREGS 0x40
+
+/* Offsets of various parts of `struct save_state'.  From
+   <machine/save_state.h>.  */
+#define HPPA_HPUX_SS_FLAGS_OFFSET 0
+#define HPPA_HPUX_SS_NARROW_OFFSET 4
+#define HPPA_HPUX_SS_FPBLOCK_OFFSET 256
+#define HPPA_HPUX_SS_WIDE_OFFSET        640
+
+/* The size of `struct save_state.  */
+#define HPPA_HPUX_SAVE_STATE_SIZE 1152
+
+/* The size of `struct pa89_save_state', which corresponds to PA-RISC
+   1.1, the lowest common denominator that we support.  */
+#define HPPA_HPUX_PA89_SAVE_STATE_SIZE 512
+
+
 /* Forward declarations.  */
 extern void _initialize_hppa_hpux_tdep (void);
 extern initialize_file_ftype _initialize_hppa_hpux_tdep;
@@ -1158,8 +1178,8 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
   struct hppa_hpux_sigtramp_unwind_cache *info;
   unsigned int flag;
-  CORE_ADDR sp, scptr;
-  int i, incr, off, szoff;
+  CORE_ADDR sp, scptr, off;
+  int i, incr, szoff;
 
   if (*this_cache)
     return *this_cache;
@@ -1170,25 +1190,29 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
 
   sp = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
 
-  scptr = sp - 1352;
+  if (IS_32BIT_TARGET (gdbarch))
+    scptr = sp - 1352;
+  else
+    scptr = sp - 1520;
+
   off = scptr;
 
   /* See /usr/include/machine/save_state.h for the structure of the save_state_t
      structure. */
   
-  flag = read_memory_unsigned_integer(scptr, 4);
-    
-  if (!(flag & 0x40))
+  flag = read_memory_unsigned_integer(scptr + HPPA_HPUX_SS_FLAGS_OFFSET, 4);
+
+  if (!(flag & HPPA_HPUX_SS_WIDEREGS))
     {
       /* Narrow registers. */
-      off = scptr + offsetof (save_state_t, ss_narrow);
+      off = scptr + HPPA_HPUX_SS_NARROW_OFFSET;
       incr = 4;
       szoff = 0;
     }
   else
     {
       /* Wide registers. */
-      off = scptr + offsetof (save_state_t, ss_wide) + 8;
+      off = scptr + HPPA_HPUX_SS_WIDE_OFFSET + 8;
       incr = 8;
       szoff = (tdep->bytes_per_address == 4 ? 4 : 0);
     }
@@ -1203,11 +1227,15 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
     {
       if (hppa_hpux_tramp_reg[i] > 0)
         info->saved_regs[hppa_hpux_tramp_reg[i]].addr = off + szoff;
+
       off += incr;
     }
 
   /* TODO: fp regs */
 
+  info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
+    info->saved_regs[HPPA_RP_REGNUM].addr;
+
   info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
 
   return info;
@@ -1760,25 +1788,6 @@ hppa_hpux_push_dummy_code (struct gdbarc
 
 
 
-/* Bit in the `ss_flag' member of `struct save_state' that indicates
-   that the 64-bit register values are live.  From
-   <machine/save_state.h>.  */
-#define HPPA_HPUX_SS_WIDEREGS 0x40
-
-/* Offsets of various parts of `struct save_state'.  From
-   <machine/save_state.h>.  */
-#define HPPA_HPUX_SS_FLAGS_OFFSET 0
-#define HPPA_HPUX_SS_NARROW_OFFSET 4
-#define HPPA_HPUX_SS_FPBLOCK_OFFSET 256
-#define HPPA_HPUX_SS_WIDE_OFFSET        640
-
-/* The size of `struct save_state.  */
-#define HPPA_HPUX_SAVE_STATE_SIZE 1152
-
-/* The size of `struct pa89_save_state', which corresponds to PA-RISC
-   1.1, the lowest common denominator that we support.  */
-#define HPPA_HPUX_PA89_SAVE_STATE_SIZE 512
-
 static void
 hppa_hpux_supply_ss_narrow (struct regcache *regcache,
     int regnum, const char *save_state)
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Mark Kettenis
> Date: Thu, 17 Nov 2005 20:17:15 +0800
> From: Randolph Chung <[hidden email]>
>
> Here's the new version.
>
> 2005-11-15  Randolph Chung  <[hidden email]>
>
> * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Use
> HPPA_HPUX_SS_* constants.  Ensure "off" is large enough to hold
> 64-bit offset.  Set proper signal context offset for 64-bit
> programs.  Set pc properly for signal frames.

Looks good to me!  Thanks for making those changes.

Mark
Reply | Threaded
Open this post in threaded view
|

Re: [hppa-hpux] Signal frame unwinding support for hppa64-hp-hpux11.11

Randolph Chung
>>2005-11-15  Randolph Chung  <[hidden email]>
>>
>> * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind_cache): Use
>> HPPA_HPUX_SS_* constants.  Ensure "off" is large enough to hold
>> 64-bit offset.  Set proper signal context offset for 64-bit
>> programs.  Set pc properly for signal frames.
>
>
> Looks good to me!  Thanks for making those changes.

I've checked this in now.

randolph