diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1995-02-09 07:00:45 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1995-02-09 07:00:45 +0000 |
commit | 2d336b1b5186660c5965deb7b7728fefe0f2d14d (patch) | |
tree | 63738f35d4b8fd6e25a72ef0bcb0c7aa9a0cc203 /gdb/minsyms.c | |
parent | 151e7820c7460be261142e031fe35a7a193f8acd (diff) | |
download | gdb-2d336b1b5186660c5965deb7b7728fefe0f2d14d.zip gdb-2d336b1b5186660c5965deb7b7728fefe0f2d14d.tar.gz gdb-2d336b1b5186660c5965deb7b7728fefe0f2d14d.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r-- | gdb/minsyms.c | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 26777f8..c04a353 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -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 |