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