From: Andrew STUBBS <andrew.stubbs@st.com>
To: gdb-patches@sources.redhat.com
Subject: [SH][PATCH] Disable ABI frame sniffer
Date: Wed, 09 Nov 2005 18:08:00 -0000 [thread overview]
Message-ID: <43722DEF.8060300@st.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]
Hi,
The attached patch adds a new sh-specific command:
set backtrace abi-sniffer
This command allows the ABI frame sniffer to be disabled. The default
state remains 'on', as it is now.
It is useful to disable this sniffer because it has an irritating habit
of causing (non-fatal) errors when it runs out of frames. Specifically
it often says 'Previous frame identical to this frame (corrupt stack?)'.
This message is worrying if you do not know what it means, but it is
normally easily ignored. Unfortunately, the problem is more serious when
used in conjunction with 'thread apply' as the first error kills the
output from the rest of the threads. This command is used by some GUIs
to populate their displays.
It is difficult to see how the ABI sniffer can be made more robust
(although I have not looked into it in great detail), and it certainly
can't be made totally reliable, so the best option would seem to be to
disable it altogether.
With the ABI sniffer 'off' it is not possible to backtrace through code
that does not have CFI. On sh-elf, at least, there is always CFI when
there is debug info, so it is relatively rare that the ABI sniffer is
actually required.
I have not set the default to 'off' because that causes quite a number
of FAILs in the testsuite.
Is this all OK?
Thanks
Andrew Stubbs
[-- Attachment #2: abi_sniffer.patch --]
[-- Type: text/plain, Size: 4448 bytes --]
2005-11-09 Andrew Stubbs <andrew.stubbs@st.com>
* sh-tdep.c (backtrace_abi_sniffer): New variable.
(sh_frame_this_id): Do nothing if backtrace_abi_sniffer zero.
(sh_gdbarch_init): Add set/show abi-sniffer command.
* frame.c (set_backtrace_cmdlist): Remove static.
(show_backtrace_cmdlist): Likewise.
* frame.h (set_backtrace_cmdlist): Add extern declaration.
(show_backtrace_cmdlist): Likewise.
doc/
* gdb.texinfo (Super-H): Add 'set/show backtrace abi-sniffer'.
Index: src/gdb/sh-tdep.c
===================================================================
--- src.orig/gdb/sh-tdep.c 2005-11-01 11:43:29.000000000 +0000
+++ src/gdb/sh-tdep.c 2005-11-01 12:26:24.000000000 +0000
@@ -2377,12 +2377,18 @@ sh_frame_prev_register (struct frame_inf
frame_unwind_register (next_frame, (*realnump), valuep);
}
+static int backtrace_abi_sniffer = 1;
+
static void
sh_frame_this_id (struct frame_info *next_frame, void **this_cache,
struct frame_id *this_id)
{
struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
+ /* Is this sniffer enabled? */
+ if (!backtrace_abi_sniffer)
+ return;
+
/* This marks the outermost frame. */
if (cache->base == 0)
return;
@@ -2726,6 +2732,22 @@ sh_gdbarch_init (struct gdbarch_info inf
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
frame_unwind_append_sniffer (gdbarch, sh_frame_sniffer);
+ add_setshow_boolean_cmd ("abi-sniffer", class_obscure,
+ &backtrace_abi_sniffer, "\
+Set whether backtraces should use the ABI where there is no debug info.", "\
+Show whether backtraces should use the ABI where there is no debug info.", "\
+Normally there is debug information from which to construct a backtrace\n\
+but sometimes is is not available (e.g. in assembly code). In this case the\n\
+ABI sniffer can attempt to construct a backtrace. It is disabled by default\n\
+because it can cause inconvenient errors. Note that it does not disable the\n\
+Dwarf debug information sniffer.",
+ NULL, NULL, &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
+
+#ifdef SVR4_SHARED_LIBS
+ set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+#endif
+
return gdbarch;
}
Index: src/gdb/frame.c
===================================================================
--- src.orig/gdb/frame.c 2005-11-01 11:16:55.000000000 +0000
+++ src/gdb/frame.c 2005-11-01 11:43:29.000000000 +0000
@@ -1558,8 +1558,8 @@ frame_sp_unwind (struct frame_info *next
extern initialize_file_ftype _initialize_frame; /* -Wmissing-prototypes */
-static struct cmd_list_element *set_backtrace_cmdlist;
-static struct cmd_list_element *show_backtrace_cmdlist;
+struct cmd_list_element *set_backtrace_cmdlist;
+struct cmd_list_element *show_backtrace_cmdlist;
static void
set_backtrace_cmd (char *args, int from_tty)
Index: src/gdb/frame.h
===================================================================
--- src.orig/gdb/frame.h 2005-11-01 11:16:55.000000000 +0000
+++ src/gdb/frame.h 2005-11-01 11:43:29.000000000 +0000
@@ -660,4 +660,9 @@ extern void deprecated_update_frame_pc_h
extern void deprecated_update_frame_base_hack (struct frame_info *frame,
CORE_ADDR base);
+/* Export 'set backtrace' so that new subcommands may be added elsewhere. */
+
+extern struct cmd_list_element *set_backtrace_cmdlist;
+extern struct cmd_list_element *show_backtrace_cmdlist;
+
#endif /* !defined (FRAME_H) */
Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo 2005-11-01 11:43:29.000000000 +0000
+++ src/gdb/doc/gdb.texinfo 2005-11-01 12:56:00.000000000 +0000
@@ -14790,8 +14790,21 @@ commands:
@item regs
@kindex regs@r{, Super-H}
Show the values of all Super-H registers.
+
+@item set backtrace abi-sniffer
+@kindex set backtrace abi-sniffer
+This command enables or disables the SH ABI-based frame sniffer. This
+`sniffer' attempts to find the frames of a backtrace when there is no
+debug information (specifically CFI) to do the job properly. Sniffing
+frames is problematic so it is often best to switch this @samp{off}. It
+is @samp{on} by default.
+
+@item show backtrace abi-sniffer
+@kindex show backtrace abi-sniffer
+Show whether the abi-sniffer is enabled, or not.
@end table
+
@node WinCE
@subsection Windows CE
@cindex Windows CE
next reply other threads:[~2005-11-09 17:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-09 18:08 Andrew STUBBS [this message]
2005-11-10 0:17 ` Andreas Schwab
2005-11-10 3:30 ` Daniel Jacobowitz
2005-11-10 12:27 ` Andrew STUBBS
2005-11-10 14:24 ` Daniel Jacobowitz
2005-11-10 4:27 ` Daniel Jacobowitz
2005-11-10 13:36 ` Andrew STUBBS
2005-11-10 14:34 ` Daniel Jacobowitz
2005-11-10 23:09 ` Andrew STUBBS
2005-11-10 23:13 ` Andrew STUBBS
2005-11-11 0:10 ` Mark Kettenis
2005-11-11 10:31 ` Daniel Jacobowitz
2005-11-11 18:21 ` Andrew STUBBS
2005-11-11 10:35 ` Daniel Jacobowitz
2005-11-11 20:09 ` Andrew STUBBS
2005-11-13 18:57 ` Daniel Jacobowitz
2005-11-13 23:58 ` Jim Blandy
2005-11-23 19:52 ` Andrew STUBBS
2005-11-24 22:48 ` Andrew STUBBS
2005-11-24 23:42 ` Mark Kettenis
2005-11-10 11:11 ` Eli Zaretskii
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=43722DEF.8060300@st.com \
--to=andrew.stubbs@st.com \
--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