This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch/rfa] Handle unwinding through export stubs on hpux
- From: Randolph Chung <randolph at tausq dot org>
- To: Andrew Cagney <cagney at gnu dot org>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 17 May 2004 09:47:08 -0700
- Subject: Re: [patch/rfa] Handle unwinding through export stubs on hpux
- References: <20040515235801.GY566@tausq.org> <40A8D5A9.7000702@gnu.org>
- Reply-to: Randolph Chung <randolph at tausq dot org>
> (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;
}