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] Kill SOFUN_ADDRESS_MAYBE_MISSING


   From: Eli Zaretskii <eliz@is.elta.co.il>
   Date: Tue, 23 Apr 2002 17:51:01 +0300 (IDT)

   On Tue, 23 Apr 2002, David S. Miller wrote:
   
   >    I haven't given it a lot of thought recently, but my opinion is that
   >    the SOFUN_ADDRESS_MAYBE_MISSING code ought to be enabled everywhere.
   >    The only downside that I can think of is that we lose the ability
   >    to put a symbol at address 0.
   > 
   > Sounds find to me, how about this patch?
   
   If this patch removes SOFUN_ADDRESS_MAYBE_MISSING everywhere, please 
   don't forget to update gdbint.texinfo, which documents it.

Right you are, here is an updated patch.

2002-04-23  David S. Miller  <davem@redhat.com>

	* config/i386/tm-i386sol2.h, config/i386/tm-linux.h,
	config/powerpc/tm-linux.h, config/powerpc/tm-ppc-eabi.h,
	config/sparc/tm-sun4sol2.h (SOFUN_ADDRESS_MAYBE_MISSING): Kill.
	* dbxread.c, elfread.c, minsyms.c, mdebugread.c, symmisc.c,
	symtab.h (whole file): Act as if SOFUN_ADDRESS_MAYBE_MISSING was
	always defined, kill ifdefs.

2002-04-23  David S. Miller  <davem@redhat.com>

	* gdbint.texinfo (SOFUN_ADDRESS_MAYBE_MISSING): Delete
	definition.

--- ./config/i386/tm-i386sol2.h.~1~	Mon Jul 30 14:45:26 2001
+++ ./config/i386/tm-i386sol2.h	Mon Apr 22 23:32:49 2002
@@ -46,10 +46,6 @@
 #undef IN_SIGTRAMP
 #define IN_SIGTRAMP(pc, name) (pc == 0xFFFFFFFF)
 
-/* The SunPRO compiler puts out 0 instead of the address in N_SO symbols,
-   and for SunPRO 3.0, N_FUN symbols too.  */
-#define SOFUN_ADDRESS_MAYBE_MISSING
-
 extern char *sunpro_static_transform_name (char *);
 #define STATIC_TRANSFORM_NAME(x) sunpro_static_transform_name (x)
 #define IS_STATIC_TRANSFORM_NAME(name) ((name)[0] == '.')
--- ./config/i386/tm-linux.h.~1~	Sun Feb 24 14:56:05 2002
+++ ./config/i386/tm-linux.h	Mon Apr 22 23:32:58 2002
@@ -105,10 +105,6 @@ extern void i386_linux_write_pc (CORE_AD
    SKIP_SOLIB_RESOLVER at the top of infrun.c.  */
 #define SKIP_SOLIB_RESOLVER i386_linux_skip_solib_resolver
 extern CORE_ADDR i386_linux_skip_solib_resolver (CORE_ADDR pc);
-
-/* N_FUN symbols in shared libaries have 0 for their values and need
-   to be relocated. */
-#define SOFUN_ADDRESS_MAYBE_MISSING
 
 
 /* Support for longjmp.  */
--- ./config/powerpc/tm-linux.h.~1~	Sun Feb 24 14:56:06 2002
+++ ./config/powerpc/tm-linux.h	Mon Apr 22 23:33:05 2002
@@ -63,8 +63,4 @@ extern int ppc_linux_in_sigtramp (CORE_A
 #define PROLOGUE_FIRSTLINE_OVERLAP
 #endif
 
-/* N_FUN symbols in shared libaries have 0 for their values and need
-   to be relocated. */
-#define SOFUN_ADDRESS_MAYBE_MISSING
-
 #endif  /* #ifndef TM_LINUX_H */
--- ./config/powerpc/tm-ppc-eabi.h.~1~	Fri Apr 12 12:48:37 2002
+++ ./config/powerpc/tm-ppc-eabi.h	Mon Apr 22 23:33:13 2002
@@ -33,10 +33,6 @@
 #undef TEXT_SEGMENT_BASE
 #define TEXT_SEGMENT_BASE 1
 
-/* The value of symbols of type N_SO and N_FUN maybe null when 
-   it shouldn't be. */
-#define SOFUN_ADDRESS_MAYBE_MISSING
-
 /* Use generic shared library machinery.  */
 #include "solib.h"
 
--- ./config/sparc/tm-sun4sol2.h.~1~	Sun Jun 17 09:57:28 2001
+++ ./config/sparc/tm-sun4sol2.h	Mon Apr 22 23:33:25 2002
@@ -68,10 +68,6 @@ extern int get_longjmp_target (CORE_ADDR
 #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
 #endif /* 0 */
 
-/* The SunPRO compiler puts out 0 instead of the address in N_SO symbols,
-   and for SunPRO 3.0, N_FUN symbols too.  */
-#define SOFUN_ADDRESS_MAYBE_MISSING
-
 extern char *sunpro_static_transform_name (char *);
 #define STATIC_TRANSFORM_NAME(x) sunpro_static_transform_name (x)
 #define IS_STATIC_TRANSFORM_NAME(name) ((name)[0] == '$')
--- ./doc/gdbint.texinfo.~1~	Sun Apr 21 18:39:54 2002
+++ ./doc/gdbint.texinfo	Tue Apr 23 06:53:47 2002
@@ -3258,38 +3258,6 @@ A function that inserts or removes (depe
 the next instruction. See @file{sparc-tdep.c} and @file{rs6000-tdep.c}
 for examples.
 
-@item SOFUN_ADDRESS_MAYBE_MISSING
-@findex SOFUN_ADDRESS_MAYBE_MISSING
-Somebody clever observed that, the more actual addresses you have in the
-debug information, the more time the linker has to spend relocating
-them.  So whenever there's some other way the debugger could find the
-address it needs, you should omit it from the debug info, to make
-linking faster.
-
-@code{SOFUN_ADDRESS_MAYBE_MISSING} indicates that a particular set of
-hacks of this sort are in use, affecting @code{N_SO} and @code{N_FUN}
-entries in stabs-format debugging information.  @code{N_SO} stabs mark
-the beginning and ending addresses of compilation units in the text
-segment.  @code{N_FUN} stabs mark the starts and ends of functions.
-
-@code{SOFUN_ADDRESS_MAYBE_MISSING} means two things:
-
-@itemize @bullet
-@item
-@code{N_FUN} stabs have an address of zero.  Instead, you should find the
-addresses where the function starts by taking the function name from
-the stab, and then looking that up in the minsyms (the
-linker/assembler symbol table).  In other words, the stab has the
-name, and the linker/assembler symbol table is the only place that carries
-the address.
-
-@item
-@code{N_SO} stabs have an address of zero, too.  You just look at the
-@code{N_FUN} stabs that appear before and after the @code{N_SO} stab,
-and guess the starting and ending addresses of the compilation unit from
-them.
-@end itemize
-
 @item PCC_SOL_BROKEN
 @findex PCC_SOL_BROKEN
 (Used only in the Convex target.)
--- ./dbxread.c.~1~	Thu Mar 21 11:48:54 2002
+++ ./dbxread.c	Mon Apr 22 23:31:24 2002
@@ -1498,7 +1498,6 @@ read_dbx_symtab (struct objfile *objfile
 
 	    prev_textlow_not_set = textlow_not_set;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	    /* A zero value is probably an indication for the SunPRO 3.0
 	       compiler. end_psymtab explicitly tests for zero, so
 	       don't relocate it.  */
@@ -1510,9 +1509,7 @@ read_dbx_symtab (struct objfile *objfile
 	      }
 	    else
 	      textlow_not_set = 0;
-#else
-	    textlow_not_set = 0;
-#endif
+
 	    past_first_source_file = 1;
 
 	    if (prev_so_symnum != symnum - 1)
@@ -1865,9 +1862,9 @@ read_dbx_symtab (struct objfile *objfile
 		xfree (name);
 	      }
 	    nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-	    /* Kludges for ELF/STABS with Sun ACC */
+
 	    last_function_name = namestring;
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+
 	    /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
 	       value for the bottom of the text seg in those cases. */
 	    if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
@@ -1888,8 +1885,6 @@ read_dbx_symtab (struct objfile *objfile
 		TEXTLOW (pst) = nlist.n_value;
 		textlow_not_set = 0;
 	      }
-#endif
-	    /* End kludge.  */
 
 	    /* Keep track of the start of the last function so we
 	       can handle end of function symbols.  */
@@ -1930,9 +1925,9 @@ read_dbx_symtab (struct objfile *objfile
 		xfree (name);
 	      }
 	    nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
-	    /* Kludges for ELF/STABS with Sun ACC */
+
 	    last_function_name = namestring;
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+
 	    /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
 	       value for the bottom of the text seg in those cases. */
 	    if (nlist.n_value == ANOFFSET (objfile->section_offsets, 
@@ -1953,8 +1948,6 @@ read_dbx_symtab (struct objfile *objfile
 		TEXTLOW (pst) = nlist.n_value;
 		textlow_not_set = 0;
 	      }
-#endif
-	    /* End kludge.  */
 
 	    /* Keep track of the start of the last function so we
 	       can handle end of function symbols.  */
@@ -2081,7 +2074,6 @@ read_dbx_symtab (struct objfile *objfile
 	  continue;
 
 	  case N_ENDM:
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	  /* Solaris 2 end of module, finish current partial symbol table.
 	     end_psymtab will set TEXTHIGH (pst) to the proper value, which
 	     is necessary if a module compiled without debugging info
@@ -2096,7 +2088,6 @@ read_dbx_symtab (struct objfile *objfile
 	    includes_used = 0;
 	    dependencies_used = 0;
 	  }
-#endif
 	  continue;
 
 	  case N_RBRAC:
@@ -2228,7 +2219,6 @@ end_psymtab (struct partial_symtab *pst,
     LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst);
   TEXTHIGH (pst) = capping_text;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
   /* Under Solaris, the N_SO symbols always have a value of 0,
      instead of the usual address of the .o file.  Therefore,
      we have to do some tricks to fill in texthigh and textlow.
@@ -2300,9 +2290,6 @@ end_psymtab (struct partial_symtab *pst,
       }
     }
 
-  /* End of kludge for patching Solaris textlow and texthigh.  */
-#endif /* SOFUN_ADDRESS_MAYBE_MISSING.  */
-
   pst->n_global_syms =
     objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
   pst->n_static_syms =
@@ -3106,7 +3093,6 @@ process_one_symbol (int type, int desc, 
 	    case 'F':
 	      function_stab_type = type;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	      /* Deal with the SunPRO 3.0 compiler which omits the address
 	         from N_FUN symbols.  */
 	      if (type == N_FUN
@@ -3123,7 +3109,6 @@ process_one_symbol (int type, int desc, 
 		  if (minsym_valu != 0)
 		    valu = minsym_valu;
 		}
-#endif
 
 #ifdef SUN_FIXED_LBRAC_BUG
 	      /* The Sun acc compiler, under SunOS4, puts out
--- ./elfread.c.~1~	Tue Mar 19 11:00:03 2002
+++ ./elfread.c	Mon Apr 22 23:31:41 2002
@@ -201,10 +201,8 @@ elf_symtab_read (struct objfile *objfile
   /* If filesym is nonzero, it points to a file symbol, but we haven't
      seen any section info for it yet.  */
   asymbol *filesym = 0;
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
   /* Name of filesym, as saved on the symbol_obstack.  */
   char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack);
-#endif
   struct dbx_symfile_info *dbx = objfile->sym_stab_info;
   unsigned long size;
   int stripped = (bfd_get_symcount (objfile->obfd) == 0);
@@ -269,10 +267,8 @@ elf_symtab_read (struct objfile *objfile
 	      msym = record_minimal_symbol_and_info
 		((char *) sym->name, symaddr,
 		 mst_solib_trampoline, NULL, sym->section, objfile);
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	      if (msym != NULL)
 		msym->filename = filesymname;
-#endif
 	      continue;
 	    }
 
@@ -292,11 +288,9 @@ elf_symtab_read (struct objfile *objfile
 		  sectinfo = NULL;
 		}
 	      filesym = sym;
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	      filesymname =
 		obsavestring ((char *) filesym->name, strlen (filesym->name),
 			      &objfile->symbol_obstack);
-#endif
 	    }
 	  else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
 	    {
@@ -491,10 +485,8 @@ elf_symtab_read (struct objfile *objfile
 	      msym = record_minimal_symbol_and_info
 		((char *) sym->name, symaddr,
 		 ms_type, (void *) size, sym->section, objfile);
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 	      if (msym != NULL)
 		msym->filename = filesymname;
-#endif
 	      ELF_MAKE_MSYMBOL_SPECIAL (sym, msym);
 	    }
 	}
--- ./minsyms.c.~1~	Tue Mar 19 11:00:04 2002
+++ ./minsyms.c	Mon Apr 22 23:32:21 2002
@@ -157,14 +157,12 @@ lookup_minimal_symbol (register const ch
   unsigned int hash = msymbol_hash (name);
   unsigned int dem_hash = msymbol_hash_iw (name);
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
   if (sfile != NULL)
     {
       char *p = strrchr (sfile, '/');
       if (p != NULL)
 	sfile = p + 1;
     }
-#endif
 
   for (objfile = object_files;
        objfile != NULL && found_symbol == NULL;
@@ -193,17 +191,8 @@ lookup_minimal_symbol (register const ch
                       case mst_file_text:
                       case mst_file_data:
                       case mst_file_bss:
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
                         if (sfile == NULL || STREQ (msymbol->filename, sfile))
                           found_file_symbol = msymbol;
-#else
-                        /* We have neither the ability nor the need to
-                           deal with the SFILE parameter.  If we find
-                           more than one symbol, just return the latest
-                           one (the user can't expect useful behavior in
-                           that case).  */
-                        found_file_symbol = msymbol;
-#endif
                         break;
 
                       case mst_solib_trampoline:
@@ -264,14 +253,12 @@ lookup_minimal_symbol_text (register con
   struct minimal_symbol *found_symbol = NULL;
   struct minimal_symbol *found_file_symbol = NULL;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
   if (sfile != NULL)
     {
       char *p = strrchr (sfile, '/');
       if (p != NULL)
 	sfile = p + 1;
     }
-#endif
 
   for (objfile = object_files;
        objfile != NULL && found_symbol == NULL;
@@ -291,17 +278,8 @@ lookup_minimal_symbol_text (register con
 		  switch (MSYMBOL_TYPE (msymbol))
 		    {
 		    case mst_file_text:
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 		      if (sfile == NULL || STREQ (msymbol->filename, sfile))
 			found_file_symbol = msymbol;
-#else
-		      /* We have neither the ability nor the need to
-		         deal with the SFILE parameter.  If we find
-		         more than one symbol, just return the latest
-		         one (the user can't expect useful behavior in
-		         that case).  */
-		      found_file_symbol = msymbol;
-#endif
 		      break;
 		    default:
 		      found_symbol = msymbol;
@@ -338,14 +316,12 @@ lookup_minimal_symbol_solib_trampoline (
   struct minimal_symbol *msymbol;
   struct minimal_symbol *found_symbol = NULL;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
   if (sfile != NULL)
     {
       char *p = strrchr (sfile, '/');
       if (p != NULL)
 	sfile = p + 1;
     }
-#endif
 
   for (objfile = object_files;
        objfile != NULL && found_symbol == NULL;
@@ -505,7 +481,6 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p
   return lookup_minimal_symbol_by_pc_section (pc, find_pc_mapped_section (pc));
 }
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 CORE_ADDR
 find_stab_function_addr (char *namestring, char *filename,
 			 struct objfile *objfile)
@@ -549,7 +524,6 @@ find_stab_function_addr (char *namestrin
 
   return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
 }
-#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
 
 
 /* Return leading symbol character for a BFD. If BFD is NULL,
--- ./mdebugread.c.~1~	Mon Apr 22 03:19:35 2002
+++ ./mdebugread.c	Mon Apr 22 23:31:53 2002
@@ -2835,7 +2835,6 @@ parse_partial_symbols (struct objfile *o
 
 		      prev_textlow_not_set = textlow_not_set;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 		      /* A zero value is probably an indication for the SunPRO 3.0
 			 compiler. end_psymtab explicitly tests for zero, so
 			 don't relocate it.  */
@@ -2847,9 +2846,7 @@ parse_partial_symbols (struct objfile *o
 			}
 		      else
 			textlow_not_set = 0;
-#else
-		      textlow_not_set = 0;
-#endif
+
 		      past_first_source_file = 1;
 
 		      if (prev_so_symnum != symnum - 1)
@@ -3229,7 +3226,6 @@ parse_partial_symbols (struct objfile *o
 		    continue;
 
 		  case N_ENDM:
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 		    /* Solaris 2 end of module, finish current partial symbol table.
 		       END_PSYMTAB will set TEXTHIGH (pst) to the proper value, which
 		       is necessary if a module compiled without debugging info
@@ -3240,7 +3236,6 @@ parse_partial_symbols (struct objfile *o
 			includes_used = 0;
 			dependencies_used = 0;
 		      }
-#endif
 		    continue;
 
 		  case N_RBRAC:
--- ./symmisc.c.~1~	Fri Mar 22 10:57:08 2002
+++ ./symmisc.c	Mon Apr 22 23:32:29 2002
@@ -321,10 +321,8 @@ dump_msymbols (struct objfile *objfile, 
 	{
 	  fprintf_filtered (outfile, "  %s", SYMBOL_DEMANGLED_NAME (msymbol));
 	}
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
       if (msymbol->filename)
 	fprintf_filtered (outfile, "  %s", msymbol->filename);
-#endif
       fputs_filtered ("\n", outfile);
     }
   if (objfile->minimal_symbol_count != index)
--- ./symtab.h.~1~	Tue Apr  9 13:51:33 2002
+++ ./symtab.h	Mon Apr 22 23:32:40 2002
@@ -258,10 +258,8 @@ struct minimal_symbol
 
     char *info;
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
     /* Which source file is this symbol in?  Only relevant for mst_file_*.  */
     char *filename;
-#endif
 
     /* Classification types for this symbol.  These should be taken as "advisory
        only", since if gdb can't easily figure out a classification it simply
@@ -1139,9 +1137,7 @@ extern struct minimal_symbol *prim_recor
    enum minimal_symbol_type,
    char *info, int section, asection * bfd_section, struct objfile *);
 
-#ifdef SOFUN_ADDRESS_MAYBE_MISSING
 extern CORE_ADDR find_stab_function_addr (char *, char *, struct objfile *);
-#endif
 
 extern unsigned int msymbol_hash_iw (const char *);
 


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