From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27264 invoked by alias); 9 Nov 2005 17:14:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 27246 invoked by uid 22791); 9 Nov 2005 17:14:47 -0000 Received: from fra-del-02.spheriq.net (HELO fra-del-02.spheriq.net) (195.46.51.98) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 09 Nov 2005 17:14:47 +0000 Received: from fra-out-02.spheriq.net (fra-out-02.spheriq.net [195.46.51.130]) by fra-del-02.spheriq.net with ESMTP id jA9HEiBc012097 for ; Wed, 9 Nov 2005 17:14:44 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-02.spheriq.net with ESMTP id jA9HEgZ8001780 for ; Wed, 9 Nov 2005 17:14:42 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id jA9HEdmL021017 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Wed, 9 Nov 2005 17:14:40 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 44FA6DA43 for ; Wed, 9 Nov 2005 17:14:35 +0000 (GMT) Received: by zeta.dmz-eu.st.com (STMicroelectronics, from userid 60012) id DAAD5472FC; Wed, 9 Nov 2005 17:17:30 +0000 (GMT) Received: from zeta.dmz-eu.st.com (localhost [127.0.0.1]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 77788759AF for ; Wed, 9 Nov 2005 17:17:30 +0000 (UTC) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CD77F47303 for ; Wed, 9 Nov 2005 17:17:29 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CGQ00635 (AUTH "andrew stubbs"); Wed, 9 Nov 2005 17:14:32 GMT Message-ID: <43722DEF.8060300@st.com> Date: Wed, 09 Nov 2005 18:08:00 -0000 From: Andrew STUBBS User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [SH][PATCH] Disable ABI frame sniffer Content-Type: multipart/mixed; boundary="------------010901040307030702080303" X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.1.07 X-SW-Source: 2005-11/txt/msg00110.txt.bz2 This is a multi-part message in MIME format. --------------010901040307030702080303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1334 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 --------------010901040307030702080303 Content-Type: text/plain; name="abi_sniffer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="abi_sniffer.patch" Content-length: 4448 2005-11-09 Andrew Stubbs * 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 --------------010901040307030702080303--