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 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
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;
break;
}
- msymbol = lookup_minimal_symbol (name,
- (struct objfile *) NULL);
+ msymbol = lookup_minimal_symbol (name, NULL, NULL);
if (msymbol != NULL)
{
write_exp_msymbol (msymbol,
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,
#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
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 *));
#endif
-static void
+static struct minimal_symbol *
record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
char *name;
CORE_ADDR address;
}
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);
}
/*
/* 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;
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. */
}
/* 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);
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,
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))
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");
ALL_OBJFILES (objfile)
{
stub_symbol = lookup_minimal_symbol (SYMBOL_NAME (funsymbol),
- objfile);
+ NULL, objfile);
/* Found a symbol with the right name. */
if (stub_symbol)
{
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");
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");
}
/* 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");
/* 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
if (!sr4export)
{
- minsym = lookup_minimal_symbol ("_sr4export", NULL);
+ minsym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
if (minsym)
sr4export = SYMBOL_VALUE_ADDRESS (minsym);
else
if (!dyncall)
{
- msym = lookup_minimal_symbol ("$$dyncall", NULL);
+ msym = lookup_minimal_symbol ("$$dyncall", NULL, NULL);
if (msym)
dyncall = SYMBOL_VALUE_ADDRESS (msym);
else
if (!sr4export)
{
- msym = lookup_minimal_symbol ("_sr4export", NULL);
+ msym = lookup_minimal_symbol ("_sr4export", NULL, NULL);
if (msym)
sr4export = SYMBOL_VALUE_ADDRESS (msym);
else
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",
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);
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);
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
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);
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
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;
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)
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:
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 */
+
+\f
/* Return leading symbol character for a BFD. If BFD is NULL,
return the leading symbol character from the main 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;
MSYMBOL_INFO (msymbol) = info; /* FIXME! */
msym_bunch_index++;
msym_count++;
+ return msymbol;
}
/* Compare two minimal symbols by address and return a signed result based
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);
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);
#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;
#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;
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");
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");
/* 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");
}
/* 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");
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 */