This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] inside_entry_func() related changes


This patch changes the implementation of inside_entry_func() so that
the entry_func_{low,high}pc fields are not used.

It also enables the inside_entry_func() test within frame.c because
I need this to work for FR-V.  (Note that a previous patch removed
the inside_entry_func() call from frv-tdep.c.)

I now see the following behavior on FR-V:

    Breakpoint 1, factorial (value=5)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
    96          if (value > 1) {
    (gdb) bt
    #0  factorial (value=5)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
    #1  0x00010574 in factorial (value=6)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:97
    #2  0x000104c0 in main (argc=0, argv=0x0, envp=0x0)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:79
    (gdb) set backtrace past-main 
    (gdb) bt
    #0  factorial (value=5)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
    #1  0x00010574 in factorial (value=6)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:97
    #2  0x000104c0 in main (argc=0, argv=0x0, envp=0x0)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:79
    #3  0x00010118 in _start ()
    (gdb) set backtrace past-entry-func 
    (gdb) bt
    #0  factorial (value=5)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:96
    #1  0x00010574 in factorial (value=6)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:97
    #2  0x000104c0 in main (argc=0, argv=0x0, envp=0x0)
	at /ocotillo2/devo-frv/frv-elf/bld/../../devo/gdb/testsuite/gdb.base/break.c:79
    #3  0x00010118 in _start ()
    #4  0x00010118 in _start ()

(When backtracing past main(), it used to always give me the trace that
I show above when ``backtrace past-entry-func'' has been set.)

Okay?

	* blockframe.c (inside_entry_func): Change mechanism used to
	determine whether a given address is within the entry function
	to NOT rely upon ``entry_func_lowpc'' or ``entry_func_highpc''.
	Instead, compare ``entry_point'' with value returned by
	get_pc_function_start().
	* frame.c (backtrace_past_entry_func): New static global.
	(get_prev_frame): Enable inside_entry_func() test.  Use
	``backtrace_past_entry_func'' to allow more frames to be
	seen.
	(_initialize_frame): Define new commands "set/show backtrace
	past-entry-func".

Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.82
diff -u -p -r1.82 blockframe.c
--- blockframe.c	20 Oct 2003 14:38:42 -0000	1.82
+++ blockframe.c	22 Nov 2003 00:02:01 -0000
@@ -186,8 +186,7 @@ inside_entry_func (CORE_ADDR pc)
       if (DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0))
 	return 0;
     }
-  return (symfile_objfile->ei.entry_func_lowpc <= pc &&
-	  symfile_objfile->ei.entry_func_highpc > pc);
+  return (symfile_objfile->ei.entry_point == get_pc_function_start (pc));
 }
 
 /* Return nonzero if the function for this frame lacks a prologue.  Many
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.148
diff -u -p -r1.148 frame.c
--- frame.c	19 Nov 2003 17:35:46 -0000	1.148
+++ frame.c	22 Nov 2003 00:02:02 -0000
@@ -138,6 +138,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_func;
 static unsigned int backtrace_limit = UINT_MAX;
 
 
@@ -1817,8 +1818,6 @@ get_prev_frame (struct frame_info *this_
      dummy frame PC's 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
@@ -1832,13 +1831,11 @@ get_prev_frame (struct frame_info *this_
      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: kevinb/2003-11-21: The implementation of inside_entry_func()
+     has been revised.  Testing against the FR-V simulator shows that
+     a backtrace is correctly terminated once the start() frame has been
+     hit.  */
+  if (!backtrace_past_entry_func
       && this_frame->type != DUMMY_FRAME && this_frame->level >= 0
       && inside_entry_func (get_frame_pc (this_frame)))
     {
@@ -2411,6 +2408,19 @@ Show whether backtraces should continue 
 Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
 the backtrace at \"main\".  Set this variable if you need to see the rest\n\
 of the stack trace.",
+			   NULL, NULL, &set_backtrace_cmdlist,
+			   &show_backtrace_cmdlist);
+
+  add_setshow_boolean_cmd ("past-entry-func", class_obscure,
+			   &backtrace_past_entry_func, "\
+Set whether backtraces should continue past the entry function\n\
+Normally, any frames that exist beyond the entry function are of\n\
+little interest.  Set this variable if you need to see the rest of the stack\n\
+trace\n", "\
+Show whether backtraces should continue past the entry function\n\
+Normally, any frames that exist beyond the entry function are of\n\
+little interest.  Set this variable if you need to see the rest of the stack\n\
+trace\n",
 			   NULL, NULL, &set_backtrace_cmdlist,
 			   &show_backtrace_cmdlist);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]