diff options
author | Randolph Chung <tausq@debian.org> | 2004-11-10 21:17:58 +0000 |
---|---|---|
committer | Randolph Chung <tausq@debian.org> | 2004-11-10 21:17:58 +0000 |
commit | 2315ffec021c6c665bb4bfade30c21dba72e6018 (patch) | |
tree | a061ba2042a5daac938ab4d393fe46e7e49dcf22 /gdb | |
parent | 917c78fc592d071fd1d2ab80d1700129efdf690e (diff) | |
download | gdb-2315ffec021c6c665bb4bfade30c21dba72e6018.zip gdb-2315ffec021c6c665bb4bfade30c21dba72e6018.tar.gz gdb-2315ffec021c6c665bb4bfade30c21dba72e6018.tar.bz2 |
2004-11-10 Randolph Chung <tausq@debian.org>
* blockframe.c (inside_entry_func): Move to .....
* frame.c (inside_entry_func): ... here, and make static.
(backtrace_past_entry): New flag.
(get_prev_frame): Stop backtrace at the entry function if enabled
by flag. Update comments.
(_initialize_frame): Add command to set backtrace_past_entry flag.
* defs.h (inside_entry_func): Remove prototype.
doc/
* gdb.texinfo: Document set/show backtrace past-entry commands.
Rearrange index entries for set/show backtrace past-main.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/blockframe.c | 8 | ||||
-rw-r--r-- | gdb/defs.h | 4 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 13 | ||||
-rw-r--r-- | gdb/frame.c | 35 |
6 files changed, 54 insertions, 21 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f064ac0..e90ee92 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2004-11-10 Randolph Chung <tausq@debian.org> + + * blockframe.c (inside_entry_func): Move to ..... + * frame.c (inside_entry_func): ... here, and make static. + (backtrace_past_entry): New flag. + (get_prev_frame): Stop backtrace at the entry function if enabled + by flag. Update comments. + (_initialize_frame): Add command to set backtrace_past_entry flag. + * defs.h (inside_entry_func): Remove prototype. + 2004-11-10 Mark Kettenis <kettenis@gnu.org> * dwarf2read.c: Fix formatting. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index d752c8d..4387a68 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -43,14 +43,6 @@ void _initialize_blockframe (void); -/* Test whether THIS_FRAME is inside the process entry point function. */ - -int -inside_entry_func (struct frame_info *this_frame) -{ - return (get_frame_func (this_frame) == entry_point_address ()); -} - /* Return the innermost lexical block in execution in a specified stack frame. The frame address is assumed valid. @@ -314,10 +314,6 @@ struct symtab; struct breakpoint; struct frame_info; -/* From blockframe.c */ - -extern int inside_entry_func (struct frame_info *this_frame); - /* From utils.c */ extern void initialize_utils (void); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 346324b..bed3073 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2004-11-10 Randolph Chung <tausq@debian.org> + + * gdb.texinfo: Document set/show backtrace past-entry commands. + Rearrange index entries for set/show backtrace past-main. + 2004-11-10 Jon Beniston <jon@beniston.com> Committed by Andrew Cagney <cagney@gnu.org>. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index f603384..8a77b29 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -4120,6 +4120,19 @@ default. @kindex show backtrace Display the current user entry point backtrace policy. +@item set backtrace past-entry +@itemx set backtrace past-entry on +Backtraces will continue past the internal entry point of an application. +This entry point is encoded by the linker when the application is built, +and is likely before the user entry point @code{main} (or equivalent) is called. + +@item set backtrace past-entry off +Backtraces will stop when they encouter the internal entry point of an +application. This is the default. + +@item show backtrace past-entry +Display the current internal entry point backtrace policy. + @item set backtrace limit @var{n} @itemx set backtrace limit 0 @cindex backtrace limit diff --git a/gdb/frame.c b/gdb/frame.c index 61a9520..d0d77f5 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -115,6 +115,7 @@ static int frame_debug; /* Flag to indicate whether backtraces should stop at main et.al. */ static int backtrace_past_main; +static int backtrace_past_entry; static unsigned int backtrace_limit = UINT_MAX; static void @@ -1135,6 +1136,14 @@ inside_main_func (struct frame_info *this_frame) return maddr == get_frame_func (this_frame); } +/* Test whether THIS_FRAME is inside the process entry point function. */ + +static int +inside_entry_func (struct frame_info *this_frame) +{ + return (get_frame_func (this_frame) == entry_point_address ()); +} + /* Return a structure containing various interesting information about the frame that called THIS_FRAME. Returns NULL if there is entier no such frame or the frame fails any of a set of target-independent @@ -1212,8 +1221,6 @@ get_prev_frame (struct frame_info *this_frame) dummy frame PCs typically land in the entry func. Don't apply this test to the sentinel frame. Sentinel frames should always be allowed to unwind. */ - /* NOTE: cagney/2003-02-25: Don't enable until someone has found - hard evidence that this is needed. */ /* NOTE: cagney/2003-07-07: Fixed a bug in inside_main_func() - wasn't checking for "main" in the minimal symbols. With that fixed asm-source tests now stop in "main" instead of halting the @@ -1226,13 +1233,12 @@ get_prev_frame (struct frame_info *this_frame) I guess) to determine the address range of the start function. That should provide a far better stopper than the current heuristics. */ - /* NOTE: cagney/2003-07-15: Need to add a "set backtrace - beyond-entry-func" command so that this can be selectively - disabled. */ - if (0 -#if 0 - && backtrace_beyond_entry_func -#endif + /* NOTE: tausq/2004-10-09: this is needed if, for example, the compiler + applied tail-call optimizations to main so that a function called + from main returns directly to the caller of main. Since we don't + stop at main, we should at least stop at the entry point of the + application. */ + if (!backtrace_past_entry && this_frame->unwind->type != DUMMY_FRAME && this_frame->level >= 0 && inside_entry_func (this_frame)) { @@ -1530,6 +1536,17 @@ Whether backtraces should continue past \"main\" is %s.", NULL, NULL, &set_backtrace_cmdlist, &show_backtrace_cmdlist); + add_setshow_boolean_cmd ("past-entry", class_obscure, + &backtrace_past_entry, "\ +Set whether backtraces should continue past the entry point of a program.", "\ +Show whether backtraces should continue past the entry point of a program.", "\ +Normally there are no callers beyond the entry point of a program, so GDB\n\ +will terminate the backtrace there. Set this variable if you need to see \n\ +the rest of the stack trace.", "\ +Whether backtraces should continue past the entry point is %s.", + NULL, NULL, &set_backtrace_cmdlist, + &show_backtrace_cmdlist); + add_setshow_uinteger_cmd ("limit", class_obscure, &backtrace_limit, "\ Set an upper bound on the number of backtrace levels.", "\ |