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]

Re: [rfa:symtab] deprecate inside_entry_func


Hello,

This patch deprecates the function inside_entry_func.

PS: Ref: http://sources.redhat.com/ml/gdb-patches/2003-10/msg00533.html

Here's a revised patch. It now eliminates the [disabled] inside_entry_func call from "get_prev_frame", replacing it with the more direct [but equally disabled] get_frame_func() == entry_point_address() test. This way all calls to inside_entry_func have been eliminated from up-to-date code.


Thoughts? Symtab ok?

Andrew

2003-11-21  Andrew Cagney  <cagney@redhat.com>

	* frame.c (get_prev_frame): Replace disabled call to
	deprecated_inside_entry_func with disabled test for the frame's
	function being at the entry_point_address.
	* objfiles.h (struct entry_info): Deprecate the members
	"entry_func_lowpc", and "entry_func_lowpc".
	* symfile.c (init_entry_point_info): Update.
	* objfiles.c (objfile_relocate): Update.
	* dwarfread.c (read_func_scope): Update.
	* dwarf2read.c (read_func_scope): Update.
	* blockframe.c (deprecated_inside_entry_func): Update.
	* defs.h (deprecated_inside_entry_func): Rename
	"inside_entry_func".
	* frv-tdep.c (frv_frame_this_id): Update.
	* blockframe.c (deprecated_inside_entry_func): Rename
	"inside_entry_func".
	(legacy_frame_chain_valid): Update.

Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.82
diff -u -r1.82 blockframe.c
--- blockframe.c	20 Oct 2003 14:38:42 -0000	1.82
+++ blockframe.c	21 Nov 2003 19:40:17 -0000
@@ -164,15 +164,24 @@
 }
 
 /* Test a specified PC value to see if it is in the range of addresses
-   that correspond to the process entry point function.  See comments
-   in objfiles.h for why we might want to do this.
+   that correspond to the process entry point function.
 
-   Typically called from DEPRECATED_FRAME_CHAIN_VALID.
-
-   A PC of zero is always considered to be the bottom of the stack. */
+   NOTE: cagney/2003-11-21: Deprecate this specific _mechanism_ for
+   determining if the PC is inside the entry function.  While there's
+   nothing technically wrong with the idea of using "PC inside entry
+   function" as a condition for terminating a backtrace, there's
+   something seriously wrong with this specific implementation.  It
+   forces the symbol table code to go through all sorts of symbol
+   table load and relocation hoops just to get the test right.
+
+   NOTE: cagney/2003-11-21: The function "get_prev_frame" which could
+   reasonably be expected to test for "PC inside entry function"
+   currently has that code disabled (and if/when it is enabled will
+   use the far simpler "frame->func == entry_point_address" and not
+   this function.  */
 
 int
-inside_entry_func (CORE_ADDR pc)
+deprecated_inside_entry_func (CORE_ADDR pc)
 {
   if (pc == 0)
     return 1;
@@ -186,8 +195,8 @@
       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.deprecated_entry_func_lowpc <= pc &&
+	  symfile_objfile->ei.deprecated_entry_func_highpc > pc);
 }
 
 /* Return nonzero if the function for this frame lacks a prologue.  Many
@@ -615,7 +624,7 @@
 
   /* If we're already inside the entry function for the main objfile, then it
      isn't valid.  */
-  if (inside_entry_func (get_frame_pc (fi)))
+  if (deprecated_inside_entry_func (get_frame_pc (fi)))
     return 0;
 
   /* If we're inside the entry file, it isn't valid.  */
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.133
diff -u -r1.133 defs.h
--- defs.h	31 Oct 2003 19:19:51 -0000	1.133
+++ defs.h	21 Nov 2003 19:40:18 -0000
@@ -316,7 +316,7 @@
 
 /* From blockframe.c */
 
-extern int inside_entry_func (CORE_ADDR);
+extern int deprecated_inside_entry_func (CORE_ADDR);
 
 extern int deprecated_inside_entry_file (CORE_ADDR addr);
 
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.114
diff -u -r1.114 dwarf2read.c
--- dwarf2read.c	19 Nov 2003 15:08:01 -0000	1.114
+++ dwarf2read.c	21 Nov 2003 19:40:19 -0000
@@ -2131,8 +2131,8 @@
   if (objfile->ei.entry_point >= lowpc &&
       objfile->ei.entry_point < highpc)
     {
-      objfile->ei.entry_func_lowpc = lowpc;
-      objfile->ei.entry_func_highpc = highpc;
+      objfile->ei.deprecated_entry_func_lowpc = lowpc;
+      objfile->ei.deprecated_entry_func_highpc = highpc;
     }
 
   new = push_context (0, lowpc);
Index: dwarfread.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarfread.c,v
retrieving revision 1.31
diff -u -r1.31 dwarfread.c
--- dwarfread.c	6 Nov 2003 22:54:01 -0000	1.31
+++ dwarfread.c	21 Nov 2003 19:40:19 -0000
@@ -1767,8 +1767,8 @@
   if (objfile->ei.entry_point >= dip->at_low_pc &&
       objfile->ei.entry_point < dip->at_high_pc)
     {
-      objfile->ei.entry_func_lowpc = dip->at_low_pc;
-      objfile->ei.entry_func_highpc = dip->at_high_pc;
+      objfile->ei.deprecated_entry_func_lowpc = dip->at_low_pc;
+      objfile->ei.deprecated_entry_func_highpc = dip->at_high_pc;
     }
   new = push_context (0, dip->at_low_pc);
   new->name = new_symbol (dip, objfile);
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.148
diff -u -r1.148 frame.c
--- frame.c	19 Nov 2003 17:35:46 -0000	1.148
+++ frame.c	21 Nov 2003 19:40:20 -0000
@@ -1824,23 +1824,32 @@
      asm-source tests now stop in "main" instead of halting the
      backtrace in wierd and wonderful ways somewhere inside the entry
      file.  Suspect that deprecated_inside_entry_file and
-     inside_entry_func tests were added to work around that (now
-     fixed) case.  */
+     deprecated_inside_entry_func tests were added to work around that
+     (now fixed) case.  */
   /* NOTE: cagney/2003-07-15: danielj (if I'm reading it right)
-     suggested having the inside_entry_func test use the
+     suggested having the deprecated_inside_entry_func test use the
      inside_main_func msymbol trick (along with entry_point_address 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.  */
+     enabled/disabled.  */
+  /* NOTE: cagney/2003-10-31: Replaced disabled call to
+     deprecated_inside_entry_func with the far simpler test for the
+     frame's function being the entry point.  Still need someone to
+     firstly demonstrate a need for enabling this, and secondly
+     implement implement/test it along with the "set backtrace
+     beyond-entry-func" command.  */
   if (0
 #if 0
       && backtrace_beyond_entry_func
 #endif
       && this_frame->type != DUMMY_FRAME && this_frame->level >= 0
-      && inside_entry_func (get_frame_pc (this_frame)))
+#if 0
+      && get_frame_func (this_frame) == entry_point_address ()
+#endif
+      )
     {
       if (frame_debug)
 	{
Index: frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.61
diff -u -r1.61 frv-tdep.c
--- frv-tdep.c	7 Nov 2003 06:00:07 -0000	1.61
+++ frv-tdep.c	21 Nov 2003 19:40:20 -0000
@@ -1103,7 +1103,7 @@
 
   /* This is meant to halt the backtrace at "_start".  Make sure we
      don't halt it at a generic dummy frame. */
-  if (inside_entry_func (func))
+  if (deprecated_inside_entry_func (func))
     return;
 
   /* Check if the stack is empty.  */
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.42
diff -u -r1.42 objfiles.c
--- objfiles.c	11 Nov 2003 20:04:52 -0000	1.42
+++ objfiles.c	21 Nov 2003 19:40:20 -0000
@@ -781,10 +781,10 @@
       }
   }
 
-  if (objfile->ei.entry_func_lowpc != INVALID_ENTRY_LOWPC)
+  if (objfile->ei.deprecated_entry_func_lowpc != INVALID_ENTRY_LOWPC)
     {
-      objfile->ei.entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-      objfile->ei.entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+      objfile->ei.deprecated_entry_func_lowpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
+      objfile->ei.deprecated_entry_func_highpc += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
     }
 
   if (objfile->ei.deprecated_entry_file_lowpc != INVALID_ENTRY_LOWPC)
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.28
diff -u -r1.28 objfiles.h
--- objfiles.h	6 Nov 2003 02:52:27 -0000	1.28
+++ objfiles.h	21 Nov 2003 19:40:21 -0000
@@ -106,7 +106,7 @@
    #define DEPRECATED_FRAME_CHAIN_VALID(chain, thisframe)     \
    (chain != 0                                   \
    && !(inside_main_func ((thisframe)->pc))     \
-   && !(inside_entry_func ((thisframe)->pc)))
+   && !(deprecated_inside_entry_func ((thisframe)->pc)))
 
    and add initializations of the four scope controlling variables inside
    the object file / debugging information processing modules.  */
@@ -125,8 +125,8 @@
     /* Start (inclusive) and end (exclusive) of function containing the
        entry point. */
 
-    CORE_ADDR entry_func_lowpc;
-    CORE_ADDR entry_func_highpc;
+    CORE_ADDR deprecated_entry_func_lowpc;
+    CORE_ADDR deprecated_entry_func_highpc;
 
     /* Start (inclusive) and end (exclusive) of object file containing the
        entry point. */
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.113
diff -u -r1.113 symfile.c
--- symfile.c	15 Nov 2003 19:39:04 -0000	1.113
+++ symfile.c	21 Nov 2003 19:40:21 -0000
@@ -329,8 +329,8 @@
     }
   objfile->ei.deprecated_entry_file_lowpc = INVALID_ENTRY_LOWPC;
   objfile->ei.deprecated_entry_file_highpc = INVALID_ENTRY_HIGHPC;
-  objfile->ei.entry_func_lowpc = INVALID_ENTRY_LOWPC;
-  objfile->ei.entry_func_highpc = INVALID_ENTRY_HIGHPC;
+  objfile->ei.deprecated_entry_func_lowpc = INVALID_ENTRY_LOWPC;
+  objfile->ei.deprecated_entry_func_highpc = INVALID_ENTRY_HIGHPC;
   objfile->ei.main_func_lowpc = INVALID_ENTRY_LOWPC;
   objfile->ei.main_func_highpc = INVALID_ENTRY_HIGHPC;
 }

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