]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2004-11-10 Randolph Chung <tausq@debian.org>
authorRandolph Chung <tausq@debian.org>
Wed, 10 Nov 2004 21:17:58 +0000 (21:17 +0000)
committerRandolph Chung <tausq@debian.org>
Wed, 10 Nov 2004 21:17:58 +0000 (21:17 +0000)
* 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.

gdb/ChangeLog
gdb/blockframe.c
gdb/defs.h
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/frame.c

index f064ac069055d6b277234288e929d9873caf1444..e90ee925a3b5b2b58c7c68f8fceb319edca8aa7c 100644 (file)
@@ -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.
index d752c8dd27fc3dd53aba4724c2865bc0f6aac6e8..4387a68f1518b16c99035c900abf5d777a700563 100644 (file)
 
 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.
 
index a652fce600748ca1e66720da2e6db988571b3d92..64281e12b25e96e0e70741accf6b2304460f22c5 100644 (file)
@@ -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);
index 346324b817352c466ed72f10e2f6a9e153a69731..bed3073d62a074b7f37e1fe14edee4a9f74a4366 100644 (file)
@@ -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>.
index f603384e71e3f82a9db6c490343888701e162c5a..8a77b29153eb2db1b880815c3c4f05d20f6a17b2 100644 (file)
@@ -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
index 61a95200c2f2bea0acc259d87ae172a3910cfdc5..d0d77f50a4a2bc1c4cffd4a08afe2045089b3e23 100644 (file)
@@ -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.", "\