Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING

David S. Miller
2002-04-24T08:13:14Z

From: Elena Zannoni <ezannoni@redhat.com>
Date: Tue, 23 Apr 2002 15:05:04 -0400

If we are willing to add a filename to each minimal symbol everytime,
then we could get rid of the uses of the second type, being this much
less risky. If this is an acceptable overhead, we can get rid of the
ifdefs in symmisc.c, symtab.h, minsyms.c (this stuff was added in 1995
by Jim Kingdon).

Ok, below is a patch implementing that. If we decide that the
overhead is acceptable, someone can review this for installation.

I've commented and worked on as much of your email as I can by
myself, the rest requires input/commentary from other people.

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

* symmisc.c, symtab.h, minsyms.c (whole file): Act as if
SOFUN_ADDRESS_MAYBE_MISSING was always defined, kill ifdefs.

--- ./symmisc.c.~1~ Fri Mar 22 10:57:08 2002
+++ ./symmisc.c Wed Apr 24 01:02:44 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~ Wed Apr 24 00:15:32 2002
+++ ./symtab.h Wed Apr 24 01:02:50 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
--- ./minsyms.c.~1~ Wed Apr 24 00:16:29 2002
+++ ./minsyms.c Wed Apr 24 01:03:08 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;