* config/sparc/tm-sun4sol2.h, dbxread.c: Rename

N_SO_ADDRESS_MAYBE_MISSING to SOFUN_ADDRESS_MAYBE_MISSING.
	* symtab.h (minimal_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: Add
	filename field.
	* elfread.c (record_minimal_symbol_and_info),
	minsyms.c, symtab.h (prim_record_minimal_symbol_and_info): Return
	newly created symbol.
	* elfread.c (elf_symtab_read) [SOFUN_ADDRESS_MAYBE_MISSING]:
	Set filename field of minimal symbol.
	* symmisc.c (dump_msymbols) [SOFUN_ADDRESS_MAYBE_MISSING]:
	Print filename field.
	* minsyms.c, symtab.h (lookup_minimal_symbol): New arg sfile.
	* symm-tdep.c, somsolib.c, hppa-tdep.c, c-exp.y, f-exp.y,
	m2-exp.y, nindy-tdep.c, m3-nat.c, irix5-nat.c, hpread.c,
	os9kread.c, breakpoint.c, alpha-tdep.c, valops.c, symtab.c,
	printcmd.c, dbxread.c: Change callers to pass NULL for sfile.
	* dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]:
	Find address of function from minimal symbols.
	* partial-stab.h, case 'f', 'F': Call find_stab_function_addr
	instead of getting pst->textlow from the stab.
	* minsyms.c (find_stab_function_addr): New function.
This commit is contained in:
Jim Kingdon 1995-02-09 07:00:45 +00:00
parent 151e7820c7
commit 2d336b1b51
17 changed files with 142 additions and 49 deletions

View File

@ -1,3 +1,27 @@
Wed Feb 8 20:32:18 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
* config/sparc/tm-sun4sol2.h, dbxread.c: Rename
N_SO_ADDRESS_MAYBE_MISSING to SOFUN_ADDRESS_MAYBE_MISSING.
* symtab.h (minimal_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]: Add
filename field.
* elfread.c (record_minimal_symbol_and_info),
minsyms.c, symtab.h (prim_record_minimal_symbol_and_info): Return
newly created symbol.
* elfread.c (elf_symtab_read) [SOFUN_ADDRESS_MAYBE_MISSING]:
Set filename field of minimal symbol.
* symmisc.c (dump_msymbols) [SOFUN_ADDRESS_MAYBE_MISSING]:
Print filename field.
* minsyms.c, symtab.h (lookup_minimal_symbol): New arg sfile.
* symm-tdep.c, somsolib.c, hppa-tdep.c, c-exp.y, f-exp.y,
m2-exp.y, nindy-tdep.c, m3-nat.c, irix5-nat.c, hpread.c,
os9kread.c, breakpoint.c, alpha-tdep.c, valops.c, symtab.c,
printcmd.c, dbxread.c: Change callers to pass NULL for sfile.
* dbxread.c (process_one_symbol) [SOFUN_ADDRESS_MAYBE_MISSING]:
Find address of function from minimal symbols.
* partial-stab.h, case 'f', 'F': Call find_stab_function_addr
instead of getting pst->textlow from the stab.
* minsyms.c (find_stab_function_addr): New function.
Wed Feb 8 19:19:56 1995 Rob Savoye <rob@darkstar.cygnus.com>
* monitor.c: Fix so all the output shows up in the GUI command

View File

@ -1116,7 +1116,7 @@ alpha_call_dummy_address ()
if (entry != 0)
return entry;
sym = lookup_minimal_symbol ("_Prelude", symfile_objfile);
sym = lookup_minimal_symbol ("_Prelude", NULL, symfile_objfile);
if (!sym || MSYMBOL_TYPE (sym) != mst_text)
return 0;

View File

@ -633,8 +633,7 @@ variable: qualified_name
break;
}
msymbol = lookup_minimal_symbol (name,
(struct objfile *) NULL);
msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
{
write_exp_msymbol (msymbol,
@ -689,8 +688,8 @@ variable: name_not_typename
struct minimal_symbol *msymbol;
register char *arg = copy_name ($1.stoken);
msymbol = lookup_minimal_symbol (arg,
(struct objfile *) NULL);
msymbol =
lookup_minimal_symbol (arg, NULL, NULL);
if (msymbol != NULL)
{
write_exp_msymbol (msymbol,

View File

@ -60,8 +60,9 @@ get_longjmp_target PARAMS ((CORE_ADDR *));
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
#endif /* 0 */
/* The SunPRO compiler puts out 0 instead of the address in an N_SO symbol. */
#define N_SO_ADDRESS_MAYBE_MISSING
/* 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
#define FAULTED_USE_SIGINFO

View File

@ -81,7 +81,7 @@ free_elfinfo PARAMS ((void *));
static struct section_offsets *
elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
static void
static struct minimal_symbol *
record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
enum minimal_symbol_type, char *,
struct objfile *));
@ -171,7 +171,7 @@ elf_interpreter (abfd)
#endif
static void
static struct minimal_symbol *
record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
char *name;
CORE_ADDR address;
@ -206,8 +206,8 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
}
name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
objfile);
return prim_record_minimal_symbol_and_info
(name, address, ms_type, info, section, objfile);
}
/*
@ -258,6 +258,10 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
/* 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;
#endif
struct dbx_symfile_info *dbx = (struct dbx_symfile_info *)
objfile->sym_stab_info;
unsigned long size;
@ -340,9 +344,16 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
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))
{
struct minimal_symbol *msym;
/* Select global/local/weak symbols. Note that bfd puts abs
symbols in their own section, so all symbols we are
interested in will have a section. */
@ -498,8 +509,12 @@ elf_symtab_read (abfd, addr, objfile, dynamic)
}
/* Pass symbol size field in via BFD. FIXME!!! */
size = ((elf_symbol_type *) sym) -> internal_elf_sym.st_size;
record_minimal_symbol_and_info ((char *) sym -> name, symaddr,
ms_type, (PTR) size, objfile);
msym = record_minimal_symbol_and_info
((char *) sym -> name, symaddr,
ms_type, (PTR) size, objfile);
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
msym->filename = filesymname;
#endif
}
}
do_cleanups (back_to);

View File

@ -469,7 +469,8 @@ variable: name_not_typename
struct minimal_symbol *msymbol;
register char *arg = copy_name ($1.stoken);
msymbol = lookup_minimal_symbol (arg, NULL);
msymbol =
lookup_minimal_symbol (arg, NULL, NULL);
if (msymbol != NULL)
{
write_exp_msymbol (msymbol,

View File

@ -1066,7 +1066,7 @@ frame_chain_valid (chain, thisframe)
which is (legitimately, since it is in the user's namespace)
named Ltext_end, so we can't just ignore it. */
msym_us = lookup_minimal_symbol_by_pc (FRAME_SAVED_PC (thisframe));
msym_start = lookup_minimal_symbol ("_start", NULL);
msym_start = lookup_minimal_symbol ("_start", NULL, NULL);
if (msym_us
&& msym_start
&& SYMBOL_VALUE_ADDRESS (msym_us) == SYMBOL_VALUE_ADDRESS (msym_start))
@ -1415,7 +1415,7 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
int flags = read_register (FLAGS_REGNUM);
struct unwind_table_entry *u;
msymbol = lookup_minimal_symbol ("$$dyncall", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
if (msymbol == NULL)
error ("Can't find an address for $$dyncall trampoline");
@ -1457,7 +1457,7 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
ALL_OBJFILES (objfile)
{
stub_symbol = lookup_minimal_symbol (SYMBOL_NAME (funsymbol),
objfile);
NULL, objfile);
/* Found a symbol with the right name. */
if (stub_symbol)
{
@ -1492,9 +1492,9 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
if (u && u->stub_type == IMPORT)
{
CORE_ADDR new_fun;
msymbol = lookup_minimal_symbol ("__d_plt_call", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("__d_plt_call", NULL, NULL);
if (msymbol == NULL)
msymbol = lookup_minimal_symbol ("__gcc_plt_call", NULL);
msymbol = lookup_minimal_symbol ("__gcc_plt_call", NULL, NULL);
if (msymbol == NULL)
error ("Can't find an address for __d_plt_call or __gcc_plt_call trampoline");
@ -1507,7 +1507,7 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
else
{
/* We have to store the address of the stub in __shlib_funcptr. */
msymbol = lookup_minimal_symbol ("__shlib_funcptr",
msymbol = lookup_minimal_symbol ("__shlib_funcptr", NULL,
(struct objfile *)NULL);
if (msymbol == NULL)
error ("Can't find an address for __shlib_funcptr");
@ -1518,7 +1518,7 @@ hppa_fix_call_dummy (dummy, pc, fun, nargs, args, type, gcc_p)
}
/* We still need sr4export's address too. */
msymbol = lookup_minimal_symbol ("_sr4export", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("_sr4export", NULL, NULL);
if (msymbol == NULL)
error ("Can't find an address for _sr4export trampoline");
@ -1749,7 +1749,7 @@ in_solib_call_trampoline (pc, name)
/* First see if PC is in one of the two C-library trampolines. */
if (!dyncall)
{
minsym = lookup_minimal_symbol ("$$dyncall", NULL);
minsym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
if (minsym)
dyncall = SYMBOL_VALUE_ADDRESS (minsym);
else
@ -1758,7 +1758,7 @@ in_solib_call_trampoline (pc, name)
if (!sr4export)
{
minsym = lookup_minimal_symbol ("_sr4export", NULL);
minsym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
if (minsym)
sr4export = SYMBOL_VALUE_ADDRESS (minsym);
else
@ -1918,7 +1918,7 @@ skip_trampoline_code (pc, name)
if (!dyncall)
{
msym = lookup_minimal_symbol ("$$dyncall", NULL);
msym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
if (msym)
dyncall = SYMBOL_VALUE_ADDRESS (msym);
else
@ -1927,7 +1927,7 @@ skip_trampoline_code (pc, name)
if (!sr4export)
{
msym = lookup_minimal_symbol ("_sr4export", NULL);
msym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
if (msym)
sr4export = SYMBOL_VALUE_ADDRESS (msym);
else
@ -2021,7 +2021,7 @@ skip_trampoline_code (pc, name)
return orig_pc == pc ? 0 : pc & ~0x3;
}
libsym = lookup_minimal_symbol (SYMBOL_NAME (stubsym), NULL);
libsym = lookup_minimal_symbol (SYMBOL_NAME (stubsym), NULL, NULL);
if (libsym == NULL)
{
warning ("Unable to find library symbol for %s\n",

View File

@ -700,7 +700,7 @@ hpread_get_textlow (global, index, objfile)
return 0;
/* The minimal symbols are typically more accurate for some reason. */
msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile),
msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL,
objfile);
if (msymbol)
return SYMBOL_VALUE_ADDRESS (msymbol);

View File

@ -405,7 +405,7 @@ locate_base ()
struct minimal_symbol *msymbol;
CORE_ADDR address = 0;
msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile);
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
address = SYMBOL_VALUE_ADDRESS (msymbol);

View File

@ -625,7 +625,8 @@ variable: NAME
struct minimal_symbol *msymbol;
register char *arg = copy_name ($1);
msymbol = lookup_minimal_symbol (arg, NULL);
msymbol =
lookup_minimal_symbol (arg, NULL, NULL);
if (msymbol != NULL)
{
write_exp_msymbol

View File

@ -2462,7 +2462,7 @@ lookup_address_of_variable (name)
if (! symaddr)
{
msymbol = lookup_minimal_symbol (name, (struct objfile *) NULL);
msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol && msymbol->type == mst_data)
symaddr = SYMBOL_VALUE_ADDRESS (msymbol);

View File

@ -79,10 +79,11 @@ compare_minimal_symbols PARAMS ((const void *, const void *));
static int
compact_minimal_symbols PARAMS ((struct minimal_symbol *, int));
/* Look through all the current minimal symbol tables and find the first
minimal symbol that matches NAME. If OBJF is non-NULL, it specifies a
particular objfile and the search is limited to that objfile. Returns
a pointer to the minimal symbol that matches, or NULL if no match is found.
/* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, limit the search
to that source file. Returns a pointer to the minimal symbol that
matches, or NULL if no match is found.
Note: One instance where there may be duplicate minimal symbols with
the same name is when the symbol tables for a shared library and the
@ -90,8 +91,9 @@ compact_minimal_symbols PARAMS ((struct minimal_symbol *, int));
names (the dynamic linker deals with the duplication). */
struct minimal_symbol *
lookup_minimal_symbol (name, objf)
lookup_minimal_symbol (name, sfile, objf)
register const char *name;
const char *sfile;
struct objfile *objf;
{
struct objfile *objfile;
@ -100,6 +102,15 @@ lookup_minimal_symbol (name, objf)
struct minimal_symbol *found_file_symbol = NULL;
struct minimal_symbol *trampoline_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;
objfile = objfile -> next)
@ -118,10 +129,17 @@ lookup_minimal_symbol (name, objf)
case mst_file_text:
case mst_file_data:
case mst_file_bss:
/* It is file-local. If we find more than one, just
return the latest one (the user can't expect
useful behavior in that case). */
#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:
@ -260,6 +278,31 @@ lookup_minimal_symbol_by_pc (pc)
return (best_symbol);
}
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
CORE_ADDR
find_stab_function_addr (namestring, pst, objfile)
char *namestring;
struct partial_symtab *pst;
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 + 1);
strncpy (p, namestring, n);
p[n] = 0;
msym = lookup_minimal_symbol (p, pst->filename, objfile);
return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym);
}
#endif /* SOFUN_ADDRESS_MAYBE_MISSING */
/* Return leading symbol character for a BFD. If BFD is NULL,
return the leading symbol character from the main objfile. */
@ -320,7 +363,9 @@ prim_record_minimal_symbol (name, address, ms_type, objfile)
NULL, section, objfile);
}
void
/* Record a minimal symbol in the msym bunches. Returns the symbol
newly created. */
struct minimal_symbol *
prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
objfile)
const char *name;
@ -372,6 +417,7 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
MSYMBOL_INFO (msymbol) = info; /* FIXME! */
msym_bunch_index++;
msym_count++;
return msymbol;
}
/* Compare two minimal symbols by address and return a signed result based

View File

@ -63,7 +63,7 @@ nindy_frame_chain_valid (chain, curframe)
if ( sym != 0 ){
a = SYMBOL_VALUE (sym);
} else {
msymbol = lookup_minimal_symbol (sf, (struct objfile *) NULL);
msymbol = lookup_minimal_symbol (sf, NULL, NULL);
if (msymbol == NULL)
return 0;
a = SYMBOL_VALUE_ADDRESS (msymbol);

View File

@ -1080,7 +1080,7 @@ os9k_end_psymtab (pst, include_list, num_includes, capping_symbol_cnt,
strncpy (p, last_function_name, n);
p[n] = 0;
minsym = lookup_minimal_symbol (p, objfile);
minsym = lookup_minimal_symbol (p, NULL, objfile);
if (minsym) {
pst->texthigh = SYMBOL_VALUE_ADDRESS(minsym)+(long)MSYMBOL_INFO(minsym);

View File

@ -511,10 +511,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef DBXREAD_ONLY
/* 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 (pst && pst->textlow == 0 && !symfile_relocatable)
pst->textlow = CUR_SYMBOL_VALUE;
pst->textlow =
find_stab_function_addr (namestring, pst, objfile);
#endif
#if 0
if (startup_file_end == 0)
startup_file_end = CUR_SYMBOL_VALUE;
@ -535,10 +538,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef DBXREAD_ONLY
/* 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 (pst && pst->textlow == 0 && !symfile_relocatable)
pst->textlow = CUR_SYMBOL_VALUE;
pst->textlow =
find_stab_function_addr (namestring, pst, objfile);
#endif
#if 0
if (startup_file_end == 0)
startup_file_end = CUR_SYMBOL_VALUE;

View File

@ -138,7 +138,7 @@ som_solib_add (arg_string, from_tty, target)
if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0)
return;
msymbol = lookup_minimal_symbol ("__dld_flags", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
if (msymbol == NULL)
{
error ("Unable to find __dld_flags symbol in object file.\n");
@ -166,12 +166,12 @@ som_solib_add (arg_string, from_tty, target)
if ((dld_flags & 1) == 0)
warning ("The shared libraries were not privately mapped; setting a\nbreakpoint in a shared library will not work until you rerun the program.\n");
msymbol = lookup_minimal_symbol ("__dld_list", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("__dld_list", NULL, NULL);
if (!msymbol)
{
/* Older crt0.o files (hpux8) don't have __dld_list as a symbol,
but the data is still available if you know where to look. */
msymbol = lookup_minimal_symbol ("__dld_flags", (struct objfile *)NULL);
msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
if (!msymbol)
{
error ("Unable to find dynamic library list.\n");
@ -471,7 +471,7 @@ som_solib_create_inferior_hook()
/* Get the address of __dld_flags, if no such symbol exists, then we can
not debug the shared code. */
msymbol = lookup_minimal_symbol ("__dld_flags", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
if (msymbol == NULL)
{
error ("Unable to find __dld_flags symbol in object file.\n");
@ -499,7 +499,7 @@ som_solib_create_inferior_hook()
}
/* Now find the address of _start and set a breakpoint there. */
msymbol = lookup_minimal_symbol ("_start", symfile_objfile);
msymbol = lookup_minimal_symbol ("_start", NULL, symfile_objfile);
if (msymbol == NULL)
{
error ("Unable to find _start symbol in object file.\n");

View File

@ -47,7 +47,7 @@ symmetry_extract_return_value(type, regbuf, valbuf)
float f;
if (TYPE_CODE_FLT == TYPE_CODE(type)) {
msymbol = lookup_minimal_symbol ("1167_flt", (struct objfile *) NULL);
msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
if (msymbol != NULL) {
/* found "1167_flt" means 1167, %fp2-%fp3 */
/* float & double; 19= %fp2, 20= %fp3 */