From 7c7b66552d1cca8a2d2519232f26643dbcb6300a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 5 Aug 2013 15:51:02 +0000 Subject: 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) : 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. --- gdb/ada-lang.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gdb/ada-lang.c') diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dc5f2b6..ba59913 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4405,18 +4405,22 @@ defns_collected (struct obstack *obstackp, int finish) return (struct ada_symbol_info *) obstack_base (obstackp); } -/* Return a minimal symbol matching NAME according to Ada decoding - rules. Returns NULL if there is no such minimal symbol. Names - prefixed with "standard__" are handled specially: "standard__" is - first stripped off, and only static and global symbols are searched. */ +/* Return a bound minimal symbol matching NAME according to Ada + decoding rules. Returns an invalid symbol if there is no such + minimal symbol. Names prefixed with "standard__" are handled + 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) { + struct bound_minimal_symbol result; struct objfile *objfile; struct minimal_symbol *msymbol; 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 Standard, do a non-wild matching of the symbol name without 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) && 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 -- cgit v1.1