From: Randolph Chung <randolph@tausq.org>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfa] hppa stub unwinder
Date: Fri, 23 Apr 2004 04:00:00 -0000 [thread overview]
Message-ID: <20040423040108.GD17279@tausq.org> (raw)
Thanks for Andrew's hint, here's a stub unwinder for hppa. Helps us out
in the testsuites quite a bit. okay to checkin?
randolph
2004-04-22 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_stub_unwind_cache, hppa_stub_frame_unwind_cache)
(hppa_stub_frame_this_id, hppa_stub_frame_prev_register)
(hppa_stub_frame_unwind, hppa_stub_unwind_sniffer): New stub unwinder
for handling stackless frames.
(hppa_gdbarch_init): Link in hppa_stub_unwind_sniffer. Rearrange the
order of unwinder registration vs init_osabi so that additional
osabi-specific unwinders can be hooked in.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.149
diff -u -p -r1.149 hppa-tdep.c
--- hppa-tdep.c 23 Apr 2004 02:54:21 -0000 1.149
+++ hppa-tdep.c 23 Apr 2004 03:51:21 -0000
@@ -1840,6 +1921,84 @@ hppa_frame_base_sniffer (struct frame_in
return &hppa_frame_base;
}
+/* Stub frames, used for all kinds of call stubs. */
+struct hppa_stub_unwind_cache
+{
+ CORE_ADDR base;
+ struct trad_frame_saved_reg *saved_regs;
+};
+
+static struct hppa_stub_unwind_cache *
+hppa_stub_frame_unwind_cache (struct frame_info *next_frame,
+ void **this_cache)
+{
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
+ struct hppa_stub_unwind_cache *info;
+
+ if (*this_cache)
+ return *this_cache;
+
+ info = FRAME_OBSTACK_ZALLOC (struct hppa_stub_unwind_cache);
+ *this_cache = info;
+ info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+
+ info->saved_regs[PCOQ_HEAD_REGNUM].realreg = RP_REGNUM;
+ info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+
+ return info;
+}
+
+static void
+hppa_stub_frame_this_id (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ struct frame_id *this_id)
+{
+ struct hppa_stub_unwind_cache *info
+ = hppa_stub_frame_unwind_cache (next_frame, this_prologue_cache);
+ *this_id = frame_id_build (info->base, frame_pc_unwind (next_frame));
+}
+
+static void
+hppa_stub_frame_prev_register (struct frame_info *next_frame,
+ void **this_prologue_cache,
+ int regnum, int *optimizedp,
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, void *bufferp)
+{
+ struct hppa_stub_unwind_cache *info
+ = hppa_stub_frame_unwind_cache (next_frame, this_prologue_cache);
+ int pcoqt = (regnum == PCOQ_TAIL_REGNUM);
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
+ int regsize = register_size (gdbarch, PCOQ_HEAD_REGNUM);
+
+ if (pcoqt)
+ regnum = PCOQ_HEAD_REGNUM;
+
+ trad_frame_prev_register (next_frame, info->saved_regs, regnum,
+ optimizedp, lvalp, addrp, realnump, bufferp);
+
+ if (pcoqt)
+ store_unsigned_integer (bufferp, regsize,
+ extract_unsigned_integer (bufferp, regsize) + 4);
+}
+
+static const struct frame_unwind hppa_stub_frame_unwind = {
+ NORMAL_FRAME,
+ hppa_stub_frame_this_id,
+ hppa_stub_frame_prev_register
+};
+
+static const struct frame_unwind *
+hppa_stub_unwind_sniffer (struct frame_info *next_frame)
+{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+
+ if (IN_SOLIB_CALL_TRAMPOLINE (pc, NULL) ||
+ IN_SOLIB_RETURN_TRAMPOLINE (pc, NULL))
+ return &hppa_stub_frame_unwind;
+ return NULL;
+}
+
static struct frame_id
hppa_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
@@ -2209,19 +2368,23 @@ hppa_gdbarch_init (struct gdbarch_info i
default:
internal_error (__FILE__, __LINE__, "bad switch");
}
-
+
set_gdbarch_breakpoint_from_pc (gdbarch, hppa_breakpoint_from_pc);
+ set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
/* Frame unwind methods. */
set_gdbarch_unwind_dummy_id (gdbarch, hppa_unwind_dummy_id);
set_gdbarch_unwind_pc (gdbarch, hppa_unwind_pc);
- frame_unwind_append_sniffer (gdbarch, hppa_frame_unwind_sniffer);
- frame_base_append_sniffer (gdbarch, hppa_frame_base_sniffer);
-
- set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
+
+ /* Hook in the default unwinders. Do this last in case the osabi
+ wants to add additional unwinders. */
+ frame_unwind_append_sniffer (gdbarch, hppa_stub_unwind_sniffer);
+ frame_unwind_append_sniffer (gdbarch, hppa_frame_unwind_sniffer);
+ frame_base_append_sniffer (gdbarch, hppa_frame_base_sniffer);
+ frame_base_set_default (gdbarch, &hppa_frame_base);
return gdbarch;
}
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
next reply other threads:[~2004-04-23 4:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-23 4:00 Randolph Chung [this message]
2004-04-23 4:30 ` Daniel Jacobowitz
2004-04-24 0:03 ` Andrew Cagney
2004-04-24 6:17 ` Randolph Chung
2004-04-24 6:47 ` Randolph Chung
2004-04-28 15:49 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040423040108.GD17279@tausq.org \
--to=randolph@tausq.org \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox