* [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
[not found] ` <1020422152449.ZM1373@localhost.localdomain>
@ 2002-04-23 3:10 ` David S. Miller
2002-04-23 6:52 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: David S. Miller @ 2002-04-23 3:10 UTC (permalink / raw)
To: kevinb; +Cc: gdb, gdb-patches
From: Kevin Buettner <kevinb@redhat.com>
Date: Mon, 22 Apr 2002 08:24:49 -0700
On Apr 22, 4:09am, David S. Miller wrote:
> SOFUN_ADDRESS_MAYBE_MISSING - Gross hack time... some compilation
> environments don't fill in N_FUN/N_SO stabs, you have to compute
> them by hand by looking up function names in the symbol table and
> so forth.
>
> Much confusion in this area, some Linux targets define this, some
> not. All Solaris targets define it, but that makes sense based upon
> the commentary around the changes this macro define protects.
>
> Why don't all Linux targets define this? Do some binutils ports
> perform this optimization and others not? Or was there some bug
> in N_FUN/N_SO stabs in binutils and/or gcc that this is papering
> around? kevinb@cyghat.com is the one who added this to powerpc
> and i386 Linux.
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?
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.
--- ./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
\f
/* 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] == '$')
--- ./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 */
\f
/* 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 *);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
2002-04-23 3:10 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) David S. Miller
@ 2002-04-23 6:52 ` Eli Zaretskii
2002-04-23 7:01 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
2002-04-23 9:43 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Kevin Buettner
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
2 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2002-04-23 6:52 UTC (permalink / raw)
To: David S. Miller; +Cc: kevinb, gdb, gdb-patches
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.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 6:52 ` Eli Zaretskii
@ 2002-04-23 7:01 ` David S. Miller
2002-04-23 9:05 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: David S. Miller @ 2002-04-23 7:01 UTC (permalink / raw)
To: eliz; +Cc: kevinb, gdb, gdb-patches
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
\f
/* 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 */
\f
/* 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 *);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 7:01 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
@ 2002-04-23 9:05 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2002-04-23 9:05 UTC (permalink / raw)
To: David S. Miller; +Cc: kevinb, gdb-patches
On Tue, 23 Apr 2002, David S. Miller wrote:
> 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.
The gdbint.texinfo patch is okay with me. Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
2002-04-23 3:10 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) David S. Miller
2002-04-23 6:52 ` Eli Zaretskii
@ 2002-04-23 9:43 ` Kevin Buettner
2002-04-23 10:58 ` Michael Snyder
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
2 siblings, 1 reply; 16+ messages in thread
From: Kevin Buettner @ 2002-04-23 9:43 UTC (permalink / raw)
To: David S. Miller, kevinb; +Cc: gdb, gdb-patches
On Apr 23, 3:00am, David S. Miller wrote:
> > Why don't all Linux targets define this? Do some binutils ports
> > perform this optimization and others not? Or was there some bug
> > in N_FUN/N_SO stabs in binutils and/or gcc that this is papering
> > around? kevinb@cyghat.com is the one who added this to powerpc
> > and i386 Linux.
>
> 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?
>
> 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.
Yes, this is exactly what I had in mind. It looks okay to me, but it
needs to be carefully considered and approved (or not) by the symtab
maintainers.
As noted earlier, the downside is that we lose the ability to put a
symbol at address 0. This doesn't pose a problem for operating
systems which'll never map part of the program at address 0, but there
may be some embedded environments for which this is a concern.
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
2002-04-23 9:43 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Kevin Buettner
@ 2002-04-23 10:58 ` Michael Snyder
2002-04-23 12:10 ` Kevin Buettner
0 siblings, 1 reply; 16+ messages in thread
From: Michael Snyder @ 2002-04-23 10:58 UTC (permalink / raw)
To: Kevin Buettner; +Cc: David S. Miller, gdb, gdb-patches
Kevin Buettner wrote:
>
> On Apr 23, 3:00am, David S. Miller wrote:
>
> > > Why don't all Linux targets define this? Do some binutils ports
> > > perform this optimization and others not? Or was there some bug
> > > in N_FUN/N_SO stabs in binutils and/or gcc that this is papering
> > > around? kevinb@cyghat.com is the one who added this to powerpc
> > > and i386 Linux.
> >
> > 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?
> >
> > 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.
>
> Yes, this is exactly what I had in mind. It looks okay to me, but it
> needs to be carefully considered and approved (or not) by the symtab
> maintainers.
>
> As noted earlier, the downside is that we lose the ability to put a
> symbol at address 0. This doesn't pose a problem for operating
> systems which'll never map part of the program at address 0, but there
> may be some embedded environments for which this is a concern.
Replace "may be" with "almost certainly are".
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
2002-04-23 3:10 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) David S. Miller
2002-04-23 6:52 ` Eli Zaretskii
2002-04-23 9:43 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Kevin Buettner
@ 2002-04-23 12:05 ` Elena Zannoni
2002-04-23 23:13 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
` (2 more replies)
2 siblings, 3 replies; 16+ messages in thread
From: Elena Zannoni @ 2002-04-23 12:05 UTC (permalink / raw)
To: David S. Miller; +Cc: kevinb, Peter.Schauer, gdb, gdb-patches
David S. Miller writes:
> From: Kevin Buettner <kevinb@redhat.com>
> Date: Mon, 22 Apr 2002 08:24:49 -0700
>
> On Apr 22, 4:09am, David S. Miller wrote:
>
> > SOFUN_ADDRESS_MAYBE_MISSING - Gross hack time... some compilation
> > environments don't fill in N_FUN/N_SO stabs, you have to compute
> > them by hand by looking up function names in the symbol table and
> > so forth.
> >
> > Much confusion in this area, some Linux targets define this, some
> > not. All Solaris targets define it, but that makes sense based upon
> > the commentary around the changes this macro define protects.
> >
> > Why don't all Linux targets define this? Do some binutils ports
> > perform this optimization and others not? Or was there some bug
> > in N_FUN/N_SO stabs in binutils and/or gcc that this is papering
> > around? kevinb@cyghat.com is the one who added this to powerpc
> > and i386 Linux.
>
> 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?
>
David, what configurations did you test this change on? Did you see
regressions in the testsuite?
In any case, I agree with Kevin and Michael about this being a risky
move. SOFUN_ADDRESS_MAYBE_MISSING seems to fulfill a dual purpose: to
catch textlow problems, and to deal with multiple msyms by the same
name in different files.
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).
About symtab.h: it is possible to remove the find_stab_function_addr
by making the function static in dbxread.c, and moving its definition
there from minsyms.c. I would consider that an obvious fix.
After this step is done we can think of testing removing the other
uses.
I am cc-ing Peter Schauer, since he also worked with the macro long
time back.
Elena
> 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.
>
> --- ./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
> \f
>
> /* 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] == '$')
> --- ./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 */
> \f
>
> /* 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 *);
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO)
2002-04-23 10:58 ` Michael Snyder
@ 2002-04-23 12:10 ` Kevin Buettner
2002-04-23 23:11 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
0 siblings, 1 reply; 16+ messages in thread
From: Kevin Buettner @ 2002-04-23 12:10 UTC (permalink / raw)
To: Michael Snyder, Kevin Buettner; +Cc: David S. Miller, gdb, gdb-patches
On Apr 23, 10:46am, Michael Snyder wrote:
> Kevin Buettner wrote:
> >
> > On Apr 23, 3:00am, David S. Miller wrote:
> >
> > > > Why don't all Linux targets define this? Do some binutils ports
> > > > perform this optimization and others not? Or was there some bug
> > > > in N_FUN/N_SO stabs in binutils and/or gcc that this is papering
> > > > around? kevinb@cyghat.com is the one who added this to powerpc
> > > > and i386 Linux.
> > >
> > > 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?
> > >
> > > 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.
> >
> > Yes, this is exactly what I had in mind. It looks okay to me, but it
> > needs to be carefully considered and approved (or not) by the symtab
> > maintainers.
> >
> > As noted earlier, the downside is that we lose the ability to put a
> > symbol at address 0. This doesn't pose a problem for operating
> > systems which'll never map part of the program at address 0, but there
> > may be some embedded environments for which this is a concern.
>
> Replace "may be" with "almost certainly are".
Agreed.
I'm beginning to remember more about this now. Contrary to my previous
statements in this thread, I don't think we really lose the ability to
have symbols at address 0. We can still have them, but it's more work
to figure out that they're at zero because the minimal symbols will be
consulted to make the determination.
Kevin
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 12:10 ` Kevin Buettner
@ 2002-04-23 23:11 ` David S. Miller
0 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2002-04-23 23:11 UTC (permalink / raw)
To: kevinb; +Cc: msnyder, gdb, gdb-patches
From: Kevin Buettner <kevinb@redhat.com>
Date: Tue, 23 Apr 2002 12:10:00 -0700
I'm beginning to remember more about this now. Contrary to my previous
statements in this thread, I don't think we really lose the ability to
have symbols at address 0. We can still have them, but it's more work
to figure out that they're at zero because the minimal symbols will be
consulted to make the determination.
Ok.
If this were not the case, we could conditionalize the code with
a gdbarch boolean value that would make the code work properly in
the presence of symbols at address zero.
This all depends upon the final analysis of whether my suggested
change does, or does not actually take away the capability to have
symbols at address zero.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
@ 2002-04-23 23:13 ` David S. Miller
2002-04-24 1:03 ` David S. Miller
2002-04-24 1:13 ` David S. Miller
2 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2002-04-23 23:13 UTC (permalink / raw)
To: ezannoni; +Cc: kevinb, Peter.Schauer, gdb, gdb-patches
From: Elena Zannoni <ezannoni@redhat.com>
Date: Tue, 23 Apr 2002 15:05:04 -0400
David S. Miller writes:
> Sounds find to me, how about this patch?
David, what configurations did you test this change on? Did you see
regressions in the testsuite?
sparc-*-linux, I saw no regressions. The other platform I have
available for testing (i686-linux-gnu) already defines the
macro in question.
I will address the other areas of your email in a seperate reply.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
2002-04-23 23:13 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
@ 2002-04-24 1:03 ` David S. Miller
2002-04-24 17:40 ` Elena Zannoni
2002-04-24 1:13 ` David S. Miller
2 siblings, 1 reply; 16+ messages in thread
From: David S. Miller @ 2002-04-24 1:03 UTC (permalink / raw)
To: ezannoni; +Cc: kevinb, Peter.Schauer, gdb, gdb-patches
From: Elena Zannoni <ezannoni@redhat.com>
Date: Tue, 23 Apr 2002 15:05:04 -0400
About symtab.h: it is possible to remove the find_stab_function_addr
by making the function static in dbxread.c, and moving its definition
there from minsyms.c. I would consider that an obvious fix.
Done, as follows:
2002-04-24 David S. Miller <davem@redhat.com>
* symtab.h (find_stab_function_addr): Kill extern.
* minsyms.c (find_stab_function_addr): Remove from here...
* dbxread.c: ... to here, and mark it static.
--- ./symtab.h.~1~ Tue Apr 9 13:51:33 2002
+++ ./symtab.h Wed Apr 24 00:15:32 2002
@@ -1139,10 +1139,6 @@
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 *);
extern unsigned int msymbol_hash (const char *);
--- ./minsyms.c.~1~ Tue Mar 19 11:00:04 2002
+++ ./minsyms.c Wed Apr 24 00:16:29 2002
@@ -504,52 +504,6 @@
{
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)
-{
- struct minimal_symbol *msym;
- char *p;
- int n;
-
- p = strchr (namestring, ':');
- if (p == NULL)
- p = namestring;
- n = p - namestring;
- p = alloca (n + 2);
- strncpy (p, namestring, n);
- p[n] = 0;
-
- msym = lookup_minimal_symbol (p, filename, objfile);
- if (msym == NULL)
- {
- /* Sun Fortran appends an underscore to the minimal symbol name,
- try again with an appended underscore if the minimal symbol
- was not found. */
- p[n] = '_';
- p[n + 1] = 0;
- msym = lookup_minimal_symbol (p, filename, objfile);
- }
-
- if (msym == NULL && filename != NULL)
- {
- /* Try again without the filename. */
- p[n] = 0;
- msym = lookup_minimal_symbol (p, NULL, objfile);
- }
- if (msym == NULL && filename != NULL)
- {
- /* And try again for Sun Fortran, but without the filename. */
- p[n] = '_';
- p[n + 1] = 0;
- msym = lookup_minimal_symbol (p, NULL, objfile);
- }
-
- return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
-}
-#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
\f
/* Return leading symbol character for a BFD. If BFD is NULL,
--- ./dbxread.c.~1~ Thu Mar 21 11:48:54 2002
+++ ./dbxread.c Wed Apr 24 00:16:48 2002
@@ -1230,6 +1230,52 @@
do_cleanups (back_to);
}
+#ifdef SOFUN_ADDRESS_MAYBE_MISSING
+CORE_ADDR
+find_stab_function_addr (char *namestring, char *filename,
+ struct objfile *objfile)
+{
+ struct minimal_symbol *msym;
+ char *p;
+ int n;
+
+ p = strchr (namestring, ':');
+ if (p == NULL)
+ p = namestring;
+ n = p - namestring;
+ p = alloca (n + 2);
+ strncpy (p, namestring, n);
+ p[n] = 0;
+
+ msym = lookup_minimal_symbol (p, filename, objfile);
+ if (msym == NULL)
+ {
+ /* Sun Fortran appends an underscore to the minimal symbol name,
+ try again with an appended underscore if the minimal symbol
+ was not found. */
+ p[n] = '_';
+ p[n + 1] = 0;
+ msym = lookup_minimal_symbol (p, filename, objfile);
+ }
+
+ if (msym == NULL && filename != NULL)
+ {
+ /* Try again without the filename. */
+ p[n] = 0;
+ msym = lookup_minimal_symbol (p, NULL, objfile);
+ }
+ if (msym == NULL && filename != NULL)
+ {
+ /* And try again for Sun Fortran, but without the filename. */
+ p[n] = '_';
+ p[n + 1] = 0;
+ msym = lookup_minimal_symbol (p, NULL, objfile);
+ }
+
+ return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
+}
+#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
+
/* Setup partial_symtab's describing each source file for which
debugging information is available. */
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
2002-04-23 23:13 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
2002-04-24 1:03 ` David S. Miller
@ 2002-04-24 1:13 ` David S. Miller
2 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2002-04-24 1:13 UTC (permalink / raw)
To: ezannoni; +Cc: kevinb, Peter.Schauer, gdb, gdb-patches
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;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-24 1:03 ` David S. Miller
@ 2002-04-24 17:40 ` Elena Zannoni
2002-04-24 17:53 ` David S. Miller
0 siblings, 1 reply; 16+ messages in thread
From: Elena Zannoni @ 2002-04-24 17:40 UTC (permalink / raw)
To: David S. Miller; +Cc: ezannoni, kevinb, Peter.Schauer, gdb-patches
David S. Miller writes:
> From: Elena Zannoni <ezannoni@redhat.com>
> Date: Tue, 23 Apr 2002 15:05:04 -0400
>
> About symtab.h: it is possible to remove the find_stab_function_addr
> by making the function static in dbxread.c, and moving its definition
> there from minsyms.c. I would consider that an obvious fix.
I assume you checked it in? If not, please do.
Elena
>
> Done, as follows:
>
> 2002-04-24 David S. Miller <davem@redhat.com>
>
> * symtab.h (find_stab_function_addr): Kill extern.
> * minsyms.c (find_stab_function_addr): Remove from here...
> * dbxread.c: ... to here, and mark it static.
>
> --- ./symtab.h.~1~ Tue Apr 9 13:51:33 2002
> +++ ./symtab.h Wed Apr 24 00:15:32 2002
> @@ -1139,10 +1139,6 @@
> 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 *);
>
> extern unsigned int msymbol_hash (const char *);
> --- ./minsyms.c.~1~ Tue Mar 19 11:00:04 2002
> +++ ./minsyms.c Wed Apr 24 00:16:29 2002
> @@ -504,52 +504,6 @@
> {
> 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)
> -{
> - struct minimal_symbol *msym;
> - char *p;
> - int n;
> -
> - p = strchr (namestring, ':');
> - if (p == NULL)
> - p = namestring;
> - n = p - namestring;
> - p = alloca (n + 2);
> - strncpy (p, namestring, n);
> - p[n] = 0;
> -
> - msym = lookup_minimal_symbol (p, filename, objfile);
> - if (msym == NULL)
> - {
> - /* Sun Fortran appends an underscore to the minimal symbol name,
> - try again with an appended underscore if the minimal symbol
> - was not found. */
> - p[n] = '_';
> - p[n + 1] = 0;
> - msym = lookup_minimal_symbol (p, filename, objfile);
> - }
> -
> - if (msym == NULL && filename != NULL)
> - {
> - /* Try again without the filename. */
> - p[n] = 0;
> - msym = lookup_minimal_symbol (p, NULL, objfile);
> - }
> - if (msym == NULL && filename != NULL)
> - {
> - /* And try again for Sun Fortran, but without the filename. */
> - p[n] = '_';
> - p[n + 1] = 0;
> - msym = lookup_minimal_symbol (p, NULL, objfile);
> - }
> -
> - return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
> -}
> -#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
> \f
>
> /* Return leading symbol character for a BFD. If BFD is NULL,
> --- ./dbxread.c.~1~ Thu Mar 21 11:48:54 2002
> +++ ./dbxread.c Wed Apr 24 00:16:48 2002
> @@ -1230,6 +1230,52 @@
> do_cleanups (back_to);
> }
>
> +#ifdef SOFUN_ADDRESS_MAYBE_MISSING
> +CORE_ADDR
> +find_stab_function_addr (char *namestring, char *filename,
> + struct objfile *objfile)
> +{
> + struct minimal_symbol *msym;
> + char *p;
> + int n;
> +
> + p = strchr (namestring, ':');
> + if (p == NULL)
> + p = namestring;
> + n = p - namestring;
> + p = alloca (n + 2);
> + strncpy (p, namestring, n);
> + p[n] = 0;
> +
> + msym = lookup_minimal_symbol (p, filename, objfile);
> + if (msym == NULL)
> + {
> + /* Sun Fortran appends an underscore to the minimal symbol name,
> + try again with an appended underscore if the minimal symbol
> + was not found. */
> + p[n] = '_';
> + p[n + 1] = 0;
> + msym = lookup_minimal_symbol (p, filename, objfile);
> + }
> +
> + if (msym == NULL && filename != NULL)
> + {
> + /* Try again without the filename. */
> + p[n] = 0;
> + msym = lookup_minimal_symbol (p, NULL, objfile);
> + }
> + if (msym == NULL && filename != NULL)
> + {
> + /* And try again for Sun Fortran, but without the filename. */
> + p[n] = '_';
> + p[n + 1] = 0;
> + msym = lookup_minimal_symbol (p, NULL, objfile);
> + }
> +
> + return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
> +}
> +#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
> +
> /* Setup partial_symtab's describing each source file for which
> debugging information is available. */
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-24 17:40 ` Elena Zannoni
@ 2002-04-24 17:53 ` David S. Miller
0 siblings, 0 replies; 16+ messages in thread
From: David S. Miller @ 2002-04-24 17:53 UTC (permalink / raw)
To: ezannoni; +Cc: kevinb, Peter.Schauer, gdb-patches
From: Elena Zannoni <ezannoni@redhat.com>
Date: Wed, 24 Apr 2002 20:39:42 -0400
I assume you checked it in? If not, please do.
I did, thanks for double checking though.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
2002-04-24 8:35 Michael Elizabeth Chastain
@ 2002-04-24 17:48 ` Elena Zannoni
0 siblings, 0 replies; 16+ messages in thread
From: Elena Zannoni @ 2002-04-24 17:48 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: davem, gdb-patches, Peter.Schauer
Michael Elizabeth Chastain writes:
> For what it's worth, my native i686-pc-linux-gnu test bed has no
> regressions with this patch (five gcc's with -gdwarf-2 and -gstabs+).
>
> Michael C
The macro was defined for this target. So I would expect no differences.
Well, hopefully.
We need to test on a platform that doesn't define it.
HP-UX? Aix?
Elena
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING
@ 2002-04-24 8:35 Michael Elizabeth Chastain
2002-04-24 17:48 ` Elena Zannoni
0 siblings, 1 reply; 16+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-24 8:35 UTC (permalink / raw)
To: davem, ezannoni; +Cc: gdb-patches, gdb, kevinb, Peter.Schauer
For what it's worth, my native i686-pc-linux-gnu test bed has no
regressions with this patch (five gcc's with -gdwarf-2 and -gstabs+).
Michael C
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2002-04-25 0:53 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020422.040949.16307644.davem@redhat.com>
[not found] ` <1020422152449.ZM1373@localhost.localdomain>
2002-04-23 3:10 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) David S. Miller
2002-04-23 6:52 ` Eli Zaretskii
2002-04-23 7:01 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
2002-04-23 9:05 ` Eli Zaretskii
2002-04-23 9:43 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Kevin Buettner
2002-04-23 10:58 ` Michael Snyder
2002-04-23 12:10 ` Kevin Buettner
2002-04-23 23:11 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
2002-04-23 12:05 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING (was Re: multi-arch TODO) Elena Zannoni
2002-04-23 23:13 ` [RFA] Kill SOFUN_ADDRESS_MAYBE_MISSING David S. Miller
2002-04-24 1:03 ` David S. Miller
2002-04-24 17:40 ` Elena Zannoni
2002-04-24 17:53 ` David S. Miller
2002-04-24 1:13 ` David S. Miller
2002-04-24 8:35 Michael Elizabeth Chastain
2002-04-24 17:48 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox