aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-08-05 15:51:02 +0000
committerTom Tromey <tromey@redhat.com>2013-08-05 15:51:02 +0000
commit7c7b66552d1cca8a2d2519232f26643dbcb6300a (patch)
tree6a89fb80425d84b6e33600203b67e83cb72bc273 /gdb/symfile.c
parent6e8c566101d0cb885568e2326d9d2751d97c70b6 (diff)
downloadgdb-7c7b66552d1cca8a2d2519232f26643dbcb6300a.zip
gdb-7c7b66552d1cca8a2d2519232f26643dbcb6300a.tar.gz
gdb-7c7b66552d1cca8a2d2519232f26643dbcb6300a.tar.bz2
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.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 5129105..3328648 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3399,7 +3399,8 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
static int
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;
int word_size;
enum bfd_endian byte_order;
@@ -3414,8 +3415,8 @@ simple_read_overlay_table (void)
return 0;
}
- ovly_table_msym = lookup_minimal_symbol ("_ovly_table", NULL, NULL);
- if (! ovly_table_msym)
+ ovly_table_msym = lookup_bound_minimal_symbol ("_ovly_table");
+ if (! ovly_table_msym.minsym)
{
error (_("Error reading inferior's overlay table: couldn't find "
"`_ovly_table' array\n"
@@ -3423,7 +3424,7 @@ simple_read_overlay_table (void)
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;
byte_order = gdbarch_byte_order (gdbarch);
@@ -3431,7 +3432,7 @@ simple_read_overlay_table (void)
4, byte_order);
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,
(unsigned int *) cache_ovly_table,
cache_novlys * 4, word_size, byte_order);