* [patch/rfa] Handle unwinding through export stubs on hpux
@ 2004-05-15 23:58 Randolph Chung
2004-05-17 15:09 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Randolph Chung @ 2004-05-15 23:58 UTC (permalink / raw)
To: gdb-patches
This fixes a problem reported by Dave Anglin; when doing a backtrace
through a function that is called through an export stub, the unwinder
fails. The problem is that the stub unwinder assumes that the return
pointer doesn't change inside the stub, but the export stub changes it.
Possibly something also needs to be changed for an argument relocation
stub. Will investigate and fix that separately if needed.
tested on hppa2.0w-hp-hpux11.11.
ok to apply?
randolph
2004-05-15 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_stub_frame_unwind_cache): For HPUX stub unwinding,
check to see if we are unwinding an export stub. Export stubs clobber
the %rp in the call path and stores the original rp in a stack slot.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.156
diff -u -p -u -r1.156 hppa-tdep.c
--- hppa-tdep.c 8 May 2004 03:59:34 -0000 1.156
+++ hppa-tdep.c 15 May 2004 20:54:57 -0000
@@ -2023,6 +2023,7 @@ hppa_stub_frame_unwind_cache (struct fra
{
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct hppa_stub_unwind_cache *info;
+ struct unwind_table_entry *u;
if (*this_cache)
return *this_cache;
@@ -2031,8 +2032,19 @@ hppa_stub_frame_unwind_cache (struct fra
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
- info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ if ((gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_ELF
+ || gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
+ && (u = find_unwind_entry (frame_pc_unwind (next_frame)))
+ && (u->stub_unwind.stub_type == EXPORT))
+ {
+ info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
+ }
+ else
+ {
+ info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
+ }
return info;
}
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfa] Handle unwinding through export stubs on hpux
2004-05-15 23:58 [patch/rfa] Handle unwinding through export stubs on hpux Randolph Chung
@ 2004-05-17 15:09 ` Andrew Cagney
2004-05-17 16:47 ` Randolph Chung
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2004-05-17 15:09 UTC (permalink / raw)
To: Randolph Chung; +Cc: gdb-patches
diff -u -p -u -r1.156 hppa-tdep.c
--- hppa-tdep.c 8 May 2004 03:59:34 -0000 1.156
+++ hppa-tdep.c 15 May 2004 20:54:57 -0000
@@ -2023,6 +2023,7 @@ hppa_stub_frame_unwind_cache (struct fra
{
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct hppa_stub_unwind_cache *info;
+ struct unwind_table_entry *u;
if (*this_cache)
return *this_cache;
@@ -2031,8 +2032,19 @@ hppa_stub_frame_unwind_cache (struct fra
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
- info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ if ((gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_ELF
+ || gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
+ && (u = find_unwind_entry (frame_pc_unwind (next_frame)))
(Mark's already mentioned assignments inside conditionals). Ok after
that is fixed.
Andrew
+ && (u->stub_unwind.stub_type == EXPORT))
+ {
+ info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
+ }
+ else
+ {
+ info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
+ }
return info;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfa] Handle unwinding through export stubs on hpux
2004-05-17 15:09 ` Andrew Cagney
@ 2004-05-17 16:47 ` Randolph Chung
0 siblings, 0 replies; 4+ messages in thread
From: Randolph Chung @ 2004-05-17 16:47 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> (Mark's already mentioned assignments inside conditionals). Ok after
> that is fixed.
here's the committed version. i also added some comments.
randolph
2004-05-17 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_stub_frame_unwind_cache): For HPUX stub unwinding,
check to see if we are unwinding an export stub. Export stubs clobber
the %rp in the call path and stores the original rp in a stack slot.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.158
diff -u -p -r1.158 hppa-tdep.c
--- hppa-tdep.c 17 May 2004 15:16:39 -0000 1.158
+++ hppa-tdep.c 17 May 2004 16:44:16 -0000
@@ -1987,6 +1987,7 @@ hppa_stub_frame_unwind_cache (struct fra
{
struct gdbarch *gdbarch = get_frame_arch (next_frame);
struct hppa_stub_unwind_cache *info;
+ struct unwind_table_entry *u;
if (*this_cache)
return *this_cache;
@@ -1995,8 +1996,26 @@ hppa_stub_frame_unwind_cache (struct fra
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+
+ if (gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_ELF
+ || gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
+ {
+ /* HPUX uses export stubs in function calls; the export stub clobbers
+ the return value of the caller, and, later restores it from the
+ stack. */
+ u = find_unwind_entry (frame_pc_unwind (next_frame));
+
+ if (u && u->stub_unwind.stub_type == EXPORT)
+ {
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
+
+ return info;
+ }
+ }
+
+ /* By default we assume that stubs do not change the rp. */
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].realreg = HPPA_RP_REGNUM;
return info;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch/rfa] Handle unwinding through export stubs on hpux
@ 2004-05-17 18:46 John David Anglin
0 siblings, 0 replies; 4+ messages in thread
From: John David Anglin @ 2004-05-17 18:46 UTC (permalink / raw)
To: gdb-patches; +Cc: randolph, cagney
+ if (gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_ELF
+ || gdbarch_osabi (gdbarch) == GDB_OSABI_HPUX_SOM)
+ {
+ /* HPUX uses export stubs in function calls; the export stub clobbers
+ the return value of the caller, and, later restores it from the
+ stack. */
+ u = find_unwind_entry (frame_pc_unwind (next_frame));
+
+ if (u && u->stub_unwind.stub_type == EXPORT)
+ {
+ info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr = info->base - 24;
I don't believe that the 64-bit HP-UX runtime uses export stubs which
clobber the return value of the caller. This is only true for the SOM
runtime.
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
end of thread, other threads:[~2004-05-17 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-15 23:58 [patch/rfa] Handle unwinding through export stubs on hpux Randolph Chung
2004-05-17 15:09 ` Andrew Cagney
2004-05-17 16:47 ` Randolph Chung
2004-05-17 18:46 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