remove msymbol_objfile

This is another patch in my ongoing series to "split" objfile to share
more read-only data across inferiors.  See

    http://sourceware.org/gdb/wiki/ObjfileSplitting

When symbols are finally shared, there will be no back-link from the
symbol to its containing objfile, because there may be more than one
such objfile.  So, all such back-links must be removed.

One hidden back-link is the msymbol_objfile function.  Since
(eventually) a symbol may appear in more than one objfile, trying to
look up the objfile given just a symbol cannot work.

This patch removes msymbol_objfile in favor of using a bound minimal
symbol.  It introduces a new function to make this conversion simpler
in some spots.

The bonus of this patch is that using msymbol_objfile is slower than
simply looking up the owning objfile in the first place.

Built and regtested on x86-64 Fedora 18.

	* ada-exp.y (write_var_or_type): Use bound_minimal_symbol.
	* ada-lang.c (ada_lookup_simple_minsym): Return
	bound_minimal_symbol.
	* ada-lang.h (ada_lookup_simple_minsym): Update.
	* c-exp.y (variable): Use lookup_bound_minimal_symbol.
	* f-exp.y (variable): Use lookup_bound_minimal_symbol.
	* go-exp.y (variable): Use lookup_bound_minimal_symbol.
	* jv-exp.y (push_expression_name): Use lookup_bound_minimal_symbol.
	* m2-exp.y (variable): Use lookup_bound_minimal_symbol.
	* minsyms.c (msymbol_objfile): Remove.
	(lookup_minimal_symbol_internal): New function, from
	lookup_minimal_symbol.
	(lookup_minimal_symbol): Rewrite using
	lookup_minimal_symbol_internal.
	(lookup_bound_minimal_symbol): New function.
	* minsyms.h (msymbol_objfile): Remove.
	(lookup_bound_minimal_symbol): Declare.
	* p-exp.y (variable): Use lookup_bound_minimal_symbol.
	* parse.c (write_exp_msymbol): Change parameter to a
	bound_minimal_symbol.
	(write_dollar_variable): Use lookup_bound_minimal_symbol.
	* parser-defs.h (write_exp_msymbol): Update.
	* printcmd.c (address_info): Use lookup_bound_minimal_symbol.
	* symfile.c (simple_read_overlay_table): Use
	lookup_bound_minimal_symbol.
	* symtab.c (skip_prologue_sal): Don't use msymbol_objfile.
	(search_symbols): Likewise.
	(print_msymbol_info): Take a bound_minimal_symbol argument.
	(symtab_symbol_info, rbreak_command): Update.
	* symtab.h (struct symbol_search) <msymbol>: Change type
	to bound_minimal_symbol.
	* valops.c (find_function_in_inferior): Use
	lookup_bound_minimal_symbol.
	* value.c (value_fn_field): Use lookup_bound_minimal_symbol.
This commit is contained in:
Tom Tromey 2013-08-05 15:51:02 +00:00
parent 6e8c566101
commit 7c7b66552d
20 changed files with 180 additions and 132 deletions

View File

@ -1,3 +1,40 @@
2013-08-05 Tom Tromey <tromey@redhat.com>
* ada-exp.y (write_var_or_type): Use bound_minimal_symbol.
* ada-lang.c (ada_lookup_simple_minsym): Return
bound_minimal_symbol.
* ada-lang.h (ada_lookup_simple_minsym): Update.
* c-exp.y (variable): Use lookup_bound_minimal_symbol.
* f-exp.y (variable): Use lookup_bound_minimal_symbol.
* go-exp.y (variable): Use lookup_bound_minimal_symbol.
* jv-exp.y (push_expression_name): Use lookup_bound_minimal_symbol.
* m2-exp.y (variable): Use lookup_bound_minimal_symbol.
* minsyms.c (msymbol_objfile): Remove.
(lookup_minimal_symbol_internal): New function, from
lookup_minimal_symbol.
(lookup_minimal_symbol): Rewrite using
lookup_minimal_symbol_internal.
(lookup_bound_minimal_symbol): New function.
* minsyms.h (msymbol_objfile): Remove.
(lookup_bound_minimal_symbol): Declare.
* p-exp.y (variable): Use lookup_bound_minimal_symbol.
* parse.c (write_exp_msymbol): Change parameter to a
bound_minimal_symbol.
(write_dollar_variable): Use lookup_bound_minimal_symbol.
* parser-defs.h (write_exp_msymbol): Update.
* printcmd.c (address_info): Use lookup_bound_minimal_symbol.
* symfile.c (simple_read_overlay_table): Use
lookup_bound_minimal_symbol.
* symtab.c (skip_prologue_sal): Don't use msymbol_objfile.
(search_symbols): Likewise.
(print_msymbol_info): Take a bound_minimal_symbol argument.
(symtab_symbol_info, rbreak_command): Update.
* symtab.h (struct symbol_search) <msymbol>: Change type
to bound_minimal_symbol.
* valops.c (find_function_in_inferior): Use
lookup_bound_minimal_symbol.
* value.c (value_fn_field): Use lookup_bound_minimal_symbol.
2013-08-05 Jan Kratochvil <jan.kratochvil@redhat.com> 2013-08-05 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup. Code cleanup.

View File

@ -1369,9 +1369,9 @@ write_var_or_type (const struct block *block, struct stoken name0)
} }
else if (nsyms == 0) else if (nsyms == 0)
{ {
struct minimal_symbol *msym struct bound_minimal_symbol msym
= ada_lookup_simple_minsym (encoded_name); = ada_lookup_simple_minsym (encoded_name);
if (msym != NULL) if (msym.minsym != NULL)
{ {
write_exp_msymbol (msym); write_exp_msymbol (msym);
/* Maybe cause error here rather than later? FIXME? */ /* Maybe cause error here rather than later? FIXME? */

View File

@ -4405,18 +4405,22 @@ defns_collected (struct obstack *obstackp, int finish)
return (struct ada_symbol_info *) obstack_base (obstackp); return (struct ada_symbol_info *) obstack_base (obstackp);
} }
/* Return a minimal symbol matching NAME according to Ada decoding /* Return a bound minimal symbol matching NAME according to Ada
rules. Returns NULL if there is no such minimal symbol. Names decoding rules. Returns an invalid symbol if there is no such
prefixed with "standard__" are handled specially: "standard__" is minimal symbol. Names prefixed with "standard__" are handled
first stripped off, and only static and global symbols are searched. */ specially: "standard__" is first stripped off, and only static and
global symbols are searched. */
struct minimal_symbol * struct bound_minimal_symbol
ada_lookup_simple_minsym (const char *name) ada_lookup_simple_minsym (const char *name)
{ {
struct bound_minimal_symbol result;
struct objfile *objfile; struct objfile *objfile;
struct minimal_symbol *msymbol; struct minimal_symbol *msymbol;
const int wild_match_p = should_use_wild_match (name); const int wild_match_p = should_use_wild_match (name);
memset (&result, 0, sizeof (result));
/* Special case: If the user specifies a symbol name inside package /* Special case: If the user specifies a symbol name inside package
Standard, do a non-wild matching of the symbol name without Standard, do a non-wild matching of the symbol name without
the "standard__" prefix. This was primarily introduced in order the "standard__" prefix. This was primarily introduced in order
@ -4431,10 +4435,14 @@ ada_lookup_simple_minsym (const char *name)
{ {
if (match_name (SYMBOL_LINKAGE_NAME (msymbol), name, wild_match_p) if (match_name (SYMBOL_LINKAGE_NAME (msymbol), name, wild_match_p)
&& MSYMBOL_TYPE (msymbol) != mst_solib_trampoline) && MSYMBOL_TYPE (msymbol) != mst_solib_trampoline)
return msymbol; {
result.minsym = msymbol;
result.objfile = objfile;
break;
}
} }
return NULL; return result;
} }
/* For all subprograms that statically enclose the subprogram of the /* For all subprograms that statically enclose the subprogram of the

View File

@ -239,7 +239,7 @@ extern void ada_lookup_encoded_symbol
(const char *name, const struct block *block, domain_enum namespace, (const char *name, const struct block *block, domain_enum namespace,
struct ada_symbol_info *symbol_info); struct ada_symbol_info *symbol_info);
extern struct minimal_symbol *ada_lookup_simple_minsym (const char *); extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *);
extern void ada_fill_in_ada_prototype (struct symbol *); extern void ada_fill_in_ada_prototype (struct symbol *);

View File

@ -1004,7 +1004,7 @@ variable: qualified_name
{ {
char *name = copy_name ($2.stoken); char *name = copy_name ($2.stoken);
struct symbol *sym; struct symbol *sym;
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
sym = sym =
lookup_symbol (name, (const struct block *) NULL, lookup_symbol (name, (const struct block *) NULL,
@ -1018,8 +1018,8 @@ variable: qualified_name
break; break;
} }
msymbol = lookup_minimal_symbol (name, NULL, NULL); msymbol = lookup_bound_minimal_symbol (name);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ()) else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command.")); error (_("No symbol table is loaded. Use the \"file\" command."));
@ -1066,12 +1066,12 @@ variable: name_not_typename
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1.stoken); char *arg = copy_name ($1.stoken);
msymbol = msymbol =
lookup_minimal_symbol (arg, NULL, NULL); lookup_bound_minimal_symbol (arg);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ()) else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command.")); error (_("No symbol table is loaded. Use the \"file\" command."));

View File

@ -513,12 +513,12 @@ variable: name_not_typename
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1.stoken); char *arg = copy_name ($1.stoken);
msymbol = msymbol =
lookup_minimal_symbol (arg, NULL, NULL); lookup_bound_minimal_symbol (arg);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ()) else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command.")); error (_("No symbol table is loaded. Use the \"file\" command."));

View File

@ -616,12 +616,12 @@ variable: name_not_typename
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1.stoken); char *arg = copy_name ($1.stoken);
msymbol = msymbol =
lookup_minimal_symbol (arg, NULL, NULL); lookup_bound_minimal_symbol (arg);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () else if (!have_full_symbols ()
&& !have_partial_symbols ()) && !have_partial_symbols ())

View File

@ -1391,10 +1391,10 @@ push_expression_name (struct stoken name)
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
msymbol = lookup_minimal_symbol (tmp, NULL, NULL); msymbol = lookup_bound_minimal_symbol (tmp);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ()) else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command")); error (_("No symbol table is loaded. Use the \"file\" command"));

View File

@ -627,12 +627,12 @@ variable: NAME
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1); char *arg = copy_name ($1);
msymbol = msymbol =
lookup_minimal_symbol (arg, NULL, NULL); lookup_bound_minimal_symbol (arg);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ()) else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"symbol-file\" command.")); error (_("No symbol table is loaded. Use the \"symbol-file\" command."));

View File

@ -139,27 +139,6 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
} }
} }
/* See minsyms.h. */
struct objfile *
msymbol_objfile (struct minimal_symbol *sym)
{
struct objfile *objf;
struct minimal_symbol *tsym;
unsigned int hash
= msymbol_hash (SYMBOL_LINKAGE_NAME (sym)) % MINIMAL_SYMBOL_HASH_SIZE;
for (objf = object_files; objf; objf = objf->next)
for (tsym = objf->msymbol_hash[hash]; tsym; tsym = tsym->hash_next)
if (tsym == sym)
return objf;
/* We should always be able to find the objfile ... */
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
}
/* Look through all the current minimal symbol tables and find the /* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit first minimal symbol that matches NAME. If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, the only file-scope the search to that objfile. If SFILE is non-NULL, the only file-scope
@ -180,15 +159,14 @@ msymbol_objfile (struct minimal_symbol *sym)
Obviously, there must be distinct mangled names for each of these, Obviously, there must be distinct mangled names for each of these,
but the demangled names are all the same: S::S or S::~S. */ but the demangled names are all the same: S::S or S::~S. */
struct minimal_symbol * static struct bound_minimal_symbol
lookup_minimal_symbol (const char *name, const char *sfile, lookup_minimal_symbol_internal (const char *name, const char *sfile,
struct objfile *objf) struct objfile *objf)
{ {
struct objfile *objfile; struct objfile *objfile;
struct minimal_symbol *msymbol; struct bound_minimal_symbol found_symbol = { NULL, NULL };
struct minimal_symbol *found_symbol = NULL; struct bound_minimal_symbol found_file_symbol = { NULL, NULL };
struct minimal_symbol *found_file_symbol = NULL; struct bound_minimal_symbol trampoline_symbol = { NULL, NULL };
struct minimal_symbol *trampoline_symbol = NULL;
unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE; unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE;
@ -213,9 +191,11 @@ lookup_minimal_symbol (const char *name, const char *sfile,
} }
for (objfile = object_files; for (objfile = object_files;
objfile != NULL && found_symbol == NULL; objfile != NULL && found_symbol.minsym == NULL;
objfile = objfile->next) objfile = objfile->next)
{ {
struct minimal_symbol *msymbol;
if (objf == NULL || objf == objfile if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink) || objf == objfile->separate_debug_objfile_backlink)
{ {
@ -223,7 +203,7 @@ lookup_minimal_symbol (const char *name, const char *sfile,
and the second over the demangled hash table. */ and the second over the demangled hash table. */
int pass; int pass;
for (pass = 1; pass <= 2 && found_symbol == NULL; pass++) for (pass = 1; pass <= 2 && found_symbol.minsym == NULL; pass++)
{ {
/* Select hash list according to pass. */ /* Select hash list according to pass. */
if (pass == 1) if (pass == 1)
@ -231,7 +211,7 @@ lookup_minimal_symbol (const char *name, const char *sfile,
else else
msymbol = objfile->msymbol_demangled_hash[dem_hash]; msymbol = objfile->msymbol_demangled_hash[dem_hash];
while (msymbol != NULL && found_symbol == NULL) while (msymbol != NULL && found_symbol.minsym == NULL)
{ {
int match; int match;
@ -260,7 +240,10 @@ lookup_minimal_symbol (const char *name, const char *sfile,
case mst_file_bss: case mst_file_bss:
if (sfile == NULL if (sfile == NULL
|| filename_cmp (msymbol->filename, sfile) == 0) || filename_cmp (msymbol->filename, sfile) == 0)
found_file_symbol = msymbol; {
found_file_symbol.minsym = msymbol;
found_file_symbol.objfile = objfile;
}
break; break;
case mst_solib_trampoline: case mst_solib_trampoline:
@ -269,13 +252,17 @@ lookup_minimal_symbol (const char *name, const char *sfile,
keep looking for the *real* symbol. If the keep looking for the *real* symbol. If the
actual symbol is not found, then we'll use the actual symbol is not found, then we'll use the
trampoline entry. */ trampoline entry. */
if (trampoline_symbol == NULL) if (trampoline_symbol.minsym == NULL)
trampoline_symbol = msymbol; {
trampoline_symbol.minsym = msymbol;
trampoline_symbol.objfile = objfile;
}
break; break;
case mst_unknown: case mst_unknown:
default: default:
found_symbol = msymbol; found_symbol.minsym = msymbol;
found_symbol.objfile = objfile;
break; break;
} }
} }
@ -294,18 +281,36 @@ lookup_minimal_symbol (const char *name, const char *sfile,
xfree ((void *) modified_name); xfree ((void *) modified_name);
/* External symbols are best. */ /* External symbols are best. */
if (found_symbol) if (found_symbol.minsym != NULL)
return found_symbol; return found_symbol;
/* File-local symbols are next best. */ /* File-local symbols are next best. */
if (found_file_symbol) if (found_file_symbol.minsym != NULL)
return found_file_symbol; return found_file_symbol;
/* Symbols for shared library trampolines are next best. */ /* Symbols for shared library trampolines are next best. */
if (trampoline_symbol) return trampoline_symbol;
return trampoline_symbol; }
return NULL; /* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol (const char *name, const char *sfile,
struct objfile *objf)
{
struct bound_minimal_symbol bms = lookup_minimal_symbol_internal (name,
sfile,
objf);
return bms.minsym;
}
/* See minsyms.h. */
struct bound_minimal_symbol
lookup_bound_minimal_symbol (const char *name)
{
return lookup_minimal_symbol_internal (name, NULL, NULL);
} }
/* See minsyms.h. */ /* See minsyms.h. */

View File

@ -162,14 +162,6 @@ unsigned int msymbol_hash_iw (const char *);
/* Return the objfile that holds the minimal symbol SYM. Every
minimal symbols is held by some objfile; this will never return
NULL. */
struct objfile *msymbol_objfile (struct minimal_symbol *sym);
/* Look through all the current minimal symbol tables and find the /* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit first minimal symbol that matches NAME. If OBJF is non-NULL, limit
the search to that objfile. If SFILE is non-NULL, the only file-scope the search to that objfile. If SFILE is non-NULL, the only file-scope
@ -181,6 +173,11 @@ struct minimal_symbol *lookup_minimal_symbol (const char *,
const char *, const char *,
struct objfile *); struct objfile *);
/* Like lookup_minimal_symbol, but searches all files and objfiles
and returns a bound minimal symbol. */
struct bound_minimal_symbol lookup_bound_minimal_symbol (const char *);
/* Find the minimal symbol named NAME, and return both the minsym /* Find the minimal symbol named NAME, and return both the minsym
struct and its objfile. This only checks the linkage name. */ struct and its objfile. This only checks the linkage name. */

View File

@ -700,7 +700,7 @@ variable: qualified_name
{ {
char *name = copy_name ($2); char *name = copy_name ($2);
struct symbol *sym; struct symbol *sym;
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
sym = sym =
lookup_symbol (name, (const struct block *) NULL, lookup_symbol (name, (const struct block *) NULL,
@ -714,8 +714,8 @@ variable: qualified_name
break; break;
} }
msymbol = lookup_minimal_symbol (name, NULL, NULL); msymbol = lookup_bound_minimal_symbol (name);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () else if (!have_full_symbols ()
&& !have_partial_symbols ()) && !have_partial_symbols ())
@ -779,12 +779,12 @@ variable: name_not_typename
} }
else else
{ {
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1.stoken); char *arg = copy_name ($1.stoken);
msymbol = msymbol =
lookup_minimal_symbol (arg, NULL, NULL); lookup_bound_minimal_symbol (arg);
if (msymbol != NULL) if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol); write_exp_msymbol (msymbol);
else if (!have_full_symbols () else if (!have_full_symbols ()
&& !have_partial_symbols ()) && !have_partial_symbols ())

View File

@ -496,9 +496,10 @@ write_exp_bitstring (struct stoken str)
the expression. */ the expression. */
void void
write_exp_msymbol (struct minimal_symbol *msymbol) write_exp_msymbol (struct bound_minimal_symbol bound_msym)
{ {
struct objfile *objfile = msymbol_objfile (msymbol); struct minimal_symbol *msymbol = bound_msym.minsym;
struct objfile *objfile = bound_msym.objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol); CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol);
@ -640,7 +641,7 @@ void
write_dollar_variable (struct stoken str) write_dollar_variable (struct stoken str)
{ {
struct symbol *sym = NULL; struct symbol *sym = NULL;
struct minimal_symbol *msym = NULL; struct bound_minimal_symbol msym;
struct internalvar *isym = NULL; struct internalvar *isym = NULL;
/* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1) /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
@ -704,8 +705,8 @@ write_dollar_variable (struct stoken str)
write_exp_elt_opcode (OP_VAR_VALUE); write_exp_elt_opcode (OP_VAR_VALUE);
return; return;
} }
msym = lookup_minimal_symbol (copy_name (str), NULL, NULL); msym = lookup_bound_minimal_symbol (copy_name (str));
if (msym) if (msym.minsym)
{ {
write_exp_msymbol (msym); write_exp_msymbol (msym);
return; return;

View File

@ -195,7 +195,7 @@ extern void write_exp_elt_block (const struct block *);
extern void write_exp_elt_objfile (struct objfile *objfile); extern void write_exp_elt_objfile (struct objfile *objfile);
extern void write_exp_msymbol (struct minimal_symbol *); extern void write_exp_msymbol (struct bound_minimal_symbol);
extern void write_dollar_variable (struct stoken str); extern void write_dollar_variable (struct stoken str);

View File

@ -1201,7 +1201,7 @@ address_info (char *exp, int from_tty)
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
int regno; int regno;
struct symbol *sym; struct symbol *sym;
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
long val; long val;
struct obj_section *section; struct obj_section *section;
CORE_ADDR load_addr, context_pc = 0; CORE_ADDR load_addr, context_pc = 0;
@ -1227,14 +1227,14 @@ address_info (char *exp, int from_tty)
return; return;
} }
msymbol = lookup_minimal_symbol (exp, NULL, NULL); msymbol = lookup_bound_minimal_symbol (exp);
if (msymbol != NULL) if (msymbol.minsym != NULL)
{ {
struct objfile *objfile = msymbol_objfile (msymbol); struct objfile *objfile = msymbol.objfile;
gdbarch = get_objfile_arch (objfile); gdbarch = get_objfile_arch (objfile);
load_addr = SYMBOL_VALUE_ADDRESS (msymbol); load_addr = SYMBOL_VALUE_ADDRESS (msymbol.minsym);
printf_filtered ("Symbol \""); printf_filtered ("Symbol \"");
fprintf_symbol_filtered (gdb_stdout, exp, fprintf_symbol_filtered (gdb_stdout, exp,
@ -1242,7 +1242,7 @@ address_info (char *exp, int from_tty)
printf_filtered ("\" is at "); printf_filtered ("\" is at ");
fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout); fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
printf_filtered (" in a file compiled without debugging"); printf_filtered (" in a file compiled without debugging");
section = SYMBOL_OBJ_SECTION (objfile, msymbol); section = SYMBOL_OBJ_SECTION (objfile, msymbol.minsym);
if (section_is_overlay (section)) if (section_is_overlay (section))
{ {
load_addr = overlay_unmapped_address (load_addr, section); load_addr = overlay_unmapped_address (load_addr, section);

View File

@ -3399,7 +3399,8 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
static int static int
simple_read_overlay_table (void) simple_read_overlay_table (void)
{ {
struct minimal_symbol *novlys_msym, *ovly_table_msym; struct minimal_symbol *novlys_msym;
struct bound_minimal_symbol ovly_table_msym;
struct gdbarch *gdbarch; struct gdbarch *gdbarch;
int word_size; int word_size;
enum bfd_endian byte_order; enum bfd_endian byte_order;
@ -3414,8 +3415,8 @@ simple_read_overlay_table (void)
return 0; return 0;
} }
ovly_table_msym = lookup_minimal_symbol ("_ovly_table", NULL, NULL); ovly_table_msym = lookup_bound_minimal_symbol ("_ovly_table");
if (! ovly_table_msym) if (! ovly_table_msym.minsym)
{ {
error (_("Error reading inferior's overlay table: couldn't find " error (_("Error reading inferior's overlay table: couldn't find "
"`_ovly_table' array\n" "`_ovly_table' array\n"
@ -3423,7 +3424,7 @@ simple_read_overlay_table (void)
return 0; return 0;
} }
gdbarch = get_objfile_arch (msymbol_objfile (ovly_table_msym)); gdbarch = get_objfile_arch (ovly_table_msym.objfile);
word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT; word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
byte_order = gdbarch_byte_order (gdbarch); byte_order = gdbarch_byte_order (gdbarch);
@ -3431,7 +3432,7 @@ simple_read_overlay_table (void)
4, byte_order); 4, byte_order);
cache_ovly_table cache_ovly_table
= (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table)); = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (ovly_table_msym); cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (ovly_table_msym.minsym);
read_target_long_array (cache_ovly_table_base, read_target_long_array (cache_ovly_table_base,
(unsigned int *) cache_ovly_table, (unsigned int *) cache_ovly_table,
cache_novlys * 4, word_size, byte_order); cache_novlys * 4, word_size, byte_order);

View File

@ -101,8 +101,6 @@ struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
const char *name, const char *name,
const domain_enum domain); const domain_enum domain);
static void print_msymbol_info (struct minimal_symbol *);
void _initialize_symtab (void); void _initialize_symtab (void);
/* */ /* */
@ -2832,19 +2830,19 @@ skip_prologue_sal (struct symtab_and_line *sal)
} }
else else
{ {
struct minimal_symbol *msymbol struct bound_minimal_symbol msymbol
= lookup_minimal_symbol_by_pc_section (sal->pc, sal->section).minsym; = lookup_minimal_symbol_by_pc_section (sal->pc, sal->section);
if (msymbol == NULL) if (msymbol.minsym == NULL)
{ {
do_cleanups (old_chain); do_cleanups (old_chain);
return; return;
} }
objfile = msymbol_objfile (msymbol); objfile = msymbol.objfile;
pc = SYMBOL_VALUE_ADDRESS (msymbol); pc = SYMBOL_VALUE_ADDRESS (msymbol.minsym);
section = SYMBOL_OBJ_SECTION (objfile, msymbol); section = SYMBOL_OBJ_SECTION (objfile, msymbol.minsym);
name = SYMBOL_LINKAGE_NAME (msymbol); name = SYMBOL_LINKAGE_NAME (msymbol.minsym);
} }
gdbarch = get_objfile_arch (objfile); gdbarch = get_objfile_arch (objfile);
@ -3666,7 +3664,7 @@ search_symbols (char *regexp, enum search_domain kind,
psr->block = i; psr->block = i;
psr->symtab = real_symtab; psr->symtab = real_symtab;
psr->symbol = sym; psr->symbol = sym;
psr->msymbol = NULL; memset (&psr->msymbol, 0, sizeof (psr->msymbol));
psr->next = NULL; psr->next = NULL;
if (tail == NULL) if (tail == NULL)
found = psr; found = psr;
@ -3719,7 +3717,8 @@ search_symbols (char *regexp, enum search_domain kind,
struct symbol_search *psr = (struct symbol_search *) struct symbol_search *psr = (struct symbol_search *)
xmalloc (sizeof (struct symbol_search)); xmalloc (sizeof (struct symbol_search));
psr->block = i; psr->block = i;
psr->msymbol = msymbol; psr->msymbol.minsym = msymbol;
psr->msymbol.objfile = objfile;
psr->symtab = NULL; psr->symtab = NULL;
psr->symbol = NULL; psr->symbol = NULL;
psr->next = NULL; psr->next = NULL;
@ -3783,20 +3782,20 @@ print_symbol_info (enum search_domain kind,
for non-debugging symbols to gdb_stdout. */ for non-debugging symbols to gdb_stdout. */
static void static void
print_msymbol_info (struct minimal_symbol *msymbol) print_msymbol_info (struct bound_minimal_symbol msymbol)
{ {
struct gdbarch *gdbarch = get_objfile_arch (msymbol_objfile (msymbol)); struct gdbarch *gdbarch = get_objfile_arch (msymbol.objfile);
char *tmp; char *tmp;
if (gdbarch_addr_bit (gdbarch) <= 32) if (gdbarch_addr_bit (gdbarch) <= 32)
tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol.minsym)
& (CORE_ADDR) 0xffffffff, & (CORE_ADDR) 0xffffffff,
8); 8);
else else
tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol), tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol.minsym),
16); 16);
printf_filtered ("%s %s\n", printf_filtered ("%s %s\n",
tmp, SYMBOL_PRINT_NAME (msymbol)); tmp, SYMBOL_PRINT_NAME (msymbol.minsym));
} }
/* This is the guts of the commands "info functions", "info types", and /* This is the guts of the commands "info functions", "info types", and
@ -3831,7 +3830,7 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
{ {
QUIT; QUIT;
if (p->msymbol != NULL) if (p->msymbol.minsym != NULL)
{ {
if (first) if (first)
{ {
@ -3928,7 +3927,7 @@ rbreak_command (char *regexp, int from_tty)
make_cleanup (do_end_rbreak_breakpoints, NULL); make_cleanup (do_end_rbreak_breakpoints, NULL);
for (p = ss; p != NULL; p = p->next) for (p = ss; p != NULL; p = p->next)
{ {
if (p->msymbol == NULL) if (p->msymbol.minsym == NULL)
{ {
const char *fullname = symtab_to_fullname (p->symtab); const char *fullname = symtab_to_fullname (p->symtab);
@ -3954,7 +3953,7 @@ rbreak_command (char *regexp, int from_tty)
} }
else else
{ {
int newlen = (strlen (SYMBOL_LINKAGE_NAME (p->msymbol)) + 3); int newlen = (strlen (SYMBOL_LINKAGE_NAME (p->msymbol.minsym)) + 3);
if (newlen > len) if (newlen > len)
{ {
@ -3962,12 +3961,12 @@ rbreak_command (char *regexp, int from_tty)
len = newlen; len = newlen;
} }
strcpy (string, "'"); strcpy (string, "'");
strcat (string, SYMBOL_LINKAGE_NAME (p->msymbol)); strcat (string, SYMBOL_LINKAGE_NAME (p->msymbol.minsym));
strcat (string, "'"); strcat (string, "'");
break_command (string, from_tty); break_command (string, from_tty);
printf_filtered ("<function, no debug info> %s;\n", printf_filtered ("<function, no debug info> %s;\n",
SYMBOL_PRINT_NAME (p->msymbol)); SYMBOL_PRINT_NAME (p->msymbol.minsym));
} }
} }

View File

@ -1299,7 +1299,7 @@ struct symbol_search
/* If msymbol is non-null, then a match was made on something for /* If msymbol is non-null, then a match was made on something for
which only minimal_symbols exist. */ which only minimal_symbols exist. */
struct minimal_symbol *msymbol; struct bound_minimal_symbol msymbol;
/* A link to the next match, or NULL for the end. */ /* A link to the next match, or NULL for the end. */
struct symbol_search *next; struct symbol_search *next;

View File

@ -149,12 +149,12 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
} }
else else
{ {
struct minimal_symbol *msymbol = struct bound_minimal_symbol msymbol =
lookup_minimal_symbol (name, NULL, NULL); lookup_bound_minimal_symbol (name);
if (msymbol != NULL) if (msymbol.minsym != NULL)
{ {
struct objfile *objfile = msymbol_objfile (msymbol); struct objfile *objfile = msymbol.objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct type *type; struct type *type;
@ -162,7 +162,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char); type = lookup_pointer_type (builtin_type (gdbarch)->builtin_char);
type = lookup_function_type (type); type = lookup_function_type (type);
type = lookup_pointer_type (type); type = lookup_pointer_type (type);
maddr = SYMBOL_VALUE_ADDRESS (msymbol); maddr = SYMBOL_VALUE_ADDRESS (msymbol.minsym);
if (objf_p) if (objf_p)
*objf_p = objfile; *objf_p = objfile;

View File

@ -2773,18 +2773,18 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
struct symbol *sym; struct symbol *sym;
struct minimal_symbol *msym; struct bound_minimal_symbol msym;
sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0); sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0);
if (sym != NULL) if (sym != NULL)
{ {
msym = NULL; memset (&msym, 0, sizeof (msym));
} }
else else
{ {
gdb_assert (sym == NULL); gdb_assert (sym == NULL);
msym = lookup_minimal_symbol (physname, NULL, NULL); msym = lookup_bound_minimal_symbol (physname);
if (msym == NULL) if (msym.minsym == NULL)
return NULL; return NULL;
} }
@ -2797,12 +2797,12 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
{ {
/* The minimal symbol might point to a function descriptor; /* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */ resolve it to the actual code address instead. */
struct objfile *objfile = msymbol_objfile (msym); struct objfile *objfile = msym.objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
set_value_address (v, set_value_address (v,
gdbarch_convert_from_func_ptr_addr gdbarch_convert_from_func_ptr_addr
(gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target)); (gdbarch, SYMBOL_VALUE_ADDRESS (msym.minsym), &current_target));
} }
if (arg1p) if (arg1p)