From: Daniel Jacobowitz <drow@false.org>
To: rearnsha@buzzard.freeserve.co.uk, gdb-patches@sources.redhat.com
Subject: RFA: ARM stub unwinder
Date: Thu, 03 Mar 2005 14:46:00 -0000 [thread overview]
Message-ID: <20050303144538.GA26195@nevyn.them.org> (raw)
This patch adds a stub unwinder for ARM, and just like other architectures
with a stub unwinder, uses it for PLT entries and unreadable code addresses.
Richard tested this on arm-netbsd and it fixed a hundred failures; I tested
it on arm-linux some time ago, and it did the same there.
OK?
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-03-02 Daniel Jacobowitz <dan@codesourcery.com>
* arm-tdep.c (arm_make_stub_cache, arm_stub_this_id)
(arm_stub_unwind, arm_stub_unwind_sniffer): New.
(arm_gdbarch_init): Add arm_stub_unwind_sniffer.
Index: arm-tdep.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/arm-tdep.c,v
retrieving revision 1.193
diff -u -p -r1.193 arm-tdep.c
--- arm-tdep.c 21 Feb 2005 07:15:47 -0000 1.193
+++ arm-tdep.c 2 Mar 2005 20:38:55 -0000
@@ -1013,6 +1013,56 @@ arm_prologue_unwind_sniffer (struct fram
return &arm_prologue_unwind;
}
+static struct arm_prologue_cache *
+arm_make_stub_cache (struct frame_info *next_frame)
+{
+ int reg;
+ struct arm_prologue_cache *cache;
+ CORE_ADDR unwound_fp;
+
+ cache = frame_obstack_zalloc (sizeof (struct arm_prologue_cache));
+ cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+
+ cache->prev_sp = frame_unwind_register_unsigned (next_frame, ARM_SP_REGNUM);
+
+ return cache;
+}
+
+/* Our frame ID for a stub frame is the current SP and LR. */
+
+static void
+arm_stub_this_id (struct frame_info *next_frame,
+ void **this_cache,
+ struct frame_id *this_id)
+{
+ struct arm_prologue_cache *cache;
+
+ if (*this_cache == NULL)
+ *this_cache = arm_make_stub_cache (next_frame);
+ cache = *this_cache;
+
+ *this_id = frame_id_build (cache->prev_sp,
+ frame_pc_unwind (next_frame));
+}
+
+struct frame_unwind arm_stub_unwind = {
+ NORMAL_FRAME,
+ arm_stub_this_id,
+ arm_prologue_prev_register
+};
+
+static const struct frame_unwind *
+arm_stub_unwind_sniffer (struct frame_info *next_frame)
+{
+ char dummy[4];
+
+ if (in_plt_section (frame_unwind_address_in_block (next_frame), NULL)
+ || target_read_memory (frame_pc_unwind (next_frame), dummy, 4) != 0)
+ return &arm_stub_unwind;
+
+ return NULL;
+}
+
static CORE_ADDR
arm_normal_frame_base (struct frame_info *next_frame, void **this_cache)
{
@@ -2737,6 +2787,7 @@ arm_gdbarch_init (struct gdbarch_info in
gdbarch_init_osabi (info, gdbarch);
/* Add some default predicates. */
+ frame_unwind_append_sniffer (gdbarch, arm_stub_unwind_sniffer);
frame_unwind_append_sniffer (gdbarch, arm_sigtramp_unwind_sniffer);
frame_unwind_append_sniffer (gdbarch, arm_prologue_unwind_sniffer);
next reply other threads:[~2005-03-03 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-03 14:46 Daniel Jacobowitz [this message]
2005-03-03 14:50 ` Richard Earnshaw
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=20050303144538.GA26195@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=rearnsha@buzzard.freeserve.co.uk \
/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