From: Ulrich Weigand Date: Mon, 19 May 2008 15:49:14 +0000 (+0000) Subject: * language.h (struct language_defn): Remove SYMTAB parameter from X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=21b556f400421068d5d1928b65750a909c2f716e;p=binutils-gdb.git * language.h (struct language_defn): Remove SYMTAB parameter from la_lookup_symbol_nonlocal callback function pointer. * ada-lang.h (ada_lookup_encoded_symbol): Remove SYMTAB parameter. (ada_lookup_encoded_symbol): Likewise. * ada-lang.c (ada_lookup_encoded_symbol): Remove SYMTAB parameter. Always call fixup_symbol_section. (ada_lookup_symbol): Remove SYMTAB parameter. (ada_lookup_symbol_nonlocal): Likewise. * ada-exp.y (write_object_renaming): Update. (find_primitive_type): Likewise. * cp-support.h (cp_lookup_symbol_nonlocal): Remove SYMTAB parameter. (cp_lookup_symbol_namespace): Likewise. * cp-namespace.c (lookup_namespace_scope): Remove SYMTAB parameter. (lookup_symbol_file): Likewise. (lookup_possible_namespace_symbol): Likewise. (cp_lookup_symbol_nonlocal): Likewise. (cp_lookup_symbol_namespace): Likewise. (cp_lookup_nested_type): Update. * scm-valprint.c (scm_inferior_print): Update. * valops.c (value_maybe_namespace_elt): Update. * solist.h (struct target_so_ops): Remove SYMTAB parameter from lookup_lib_global_symbol callback function pointer. (solib_global_lookup): Remove SYMTAB parameter. * solib.c (solib_global_lookup): Remove SYMTAB parameter. * solib-svr4.c (elf_lookup_lib_symbol): Likewise. * symtab.h (basic_lookup_symbol_nonlocal): Remove SYMTAB parameter. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_global_symbol_from_objfile): Likewise. * symtab.c (lookup_symbol_aux): Remove SYMTAB parameter. (lookup_symbol_aux_local): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_symbol_aux_symtabs): Likewise. (lookup_symbol_aux_psymtabs): Likewise. (lookup_global_symbol_from_objfile): Likewise. (basic_lookup_symbol_nonlocal): Likewise. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_in_language): Do not pass SYMTAB to lookup_symbol_aux. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c66872dbb76..3f7e92252a7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,52 @@ +2008-05-19 Ulrich Weigand + + * language.h (struct language_defn): Remove SYMTAB parameter from + la_lookup_symbol_nonlocal callback function pointer. + + * ada-lang.h (ada_lookup_encoded_symbol): Remove SYMTAB parameter. + (ada_lookup_encoded_symbol): Likewise. + * ada-lang.c (ada_lookup_encoded_symbol): Remove SYMTAB parameter. + Always call fixup_symbol_section. + (ada_lookup_symbol): Remove SYMTAB parameter. + (ada_lookup_symbol_nonlocal): Likewise. + * ada-exp.y (write_object_renaming): Update. + (find_primitive_type): Likewise. + + * cp-support.h (cp_lookup_symbol_nonlocal): Remove SYMTAB parameter. + (cp_lookup_symbol_namespace): Likewise. + * cp-namespace.c (lookup_namespace_scope): Remove SYMTAB parameter. + (lookup_symbol_file): Likewise. + (lookup_possible_namespace_symbol): Likewise. + (cp_lookup_symbol_nonlocal): Likewise. + (cp_lookup_symbol_namespace): Likewise. + (cp_lookup_nested_type): Update. + + * scm-valprint.c (scm_inferior_print): Update. + * valops.c (value_maybe_namespace_elt): Update. + + * solist.h (struct target_so_ops): Remove SYMTAB parameter from + lookup_lib_global_symbol callback function pointer. + (solib_global_lookup): Remove SYMTAB parameter. + * solib.c (solib_global_lookup): Remove SYMTAB parameter. + * solib-svr4.c (elf_lookup_lib_symbol): Likewise. + + * symtab.h (basic_lookup_symbol_nonlocal): Remove SYMTAB parameter. + (lookup_symbol_static): Likewise. + (lookup_symbol_global): Likewise. + (lookup_symbol_aux_block): Likewise. + (lookup_global_symbol_from_objfile): Likewise. + * symtab.c (lookup_symbol_aux): Remove SYMTAB parameter. + (lookup_symbol_aux_local): Likewise. + (lookup_symbol_aux_block): Likewise. + (lookup_symbol_aux_symtabs): Likewise. + (lookup_symbol_aux_psymtabs): Likewise. + (lookup_global_symbol_from_objfile): Likewise. + (basic_lookup_symbol_nonlocal): Likewise. + (lookup_symbol_static): Likewise. + (lookup_symbol_global): Likewise. + + (lookup_symbol_in_language): Do not pass SYMTAB to lookup_symbol_aux. + 2008-05-17 Pedro Alves * remote.c (init_extended_remote_ops): Fix typo. diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 1f7f13fc821..72b554e0e5a 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -869,7 +869,7 @@ write_object_renaming (struct block *orig_left_context, name = obsavestring (renamed_entity, renamed_entity_len, &temp_parse_space); sym = ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, - &block, NULL); + &block); if (sym == NULL) error (_("Could not find renamed variable: %s"), ada_decode (name)); else if (SYMBOL_CLASS (sym) == LOC_TYPEDEF) @@ -941,8 +941,7 @@ write_object_renaming (struct block *orig_left_context, renaming_expr = end; index_sym = ada_lookup_encoded_symbol (index_name, NULL, - VAR_DOMAIN, &block, - NULL); + VAR_DOMAIN, &block); if (index_sym == NULL) error (_("Could not find %s"), index_name); else if (SYMBOL_CLASS (index_sym) == LOC_TYPEDEF) @@ -1094,7 +1093,7 @@ find_primitive_type (char *name) (char *) alloca (strlen (name) + sizeof ("standard__")); strcpy (expanded_name, "standard__"); strcat (expanded_name, name); - sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL, NULL); + sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL); if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) type = SYMBOL_TYPE (sym); } diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 8f710f49f49..baeef0a923c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4872,8 +4872,7 @@ done: struct symbol * ada_lookup_encoded_symbol (const char *name, const struct block *block0, - domain_enum namespace, - struct block **block_found, struct symtab **symtab) + domain_enum namespace, struct block **block_found) { struct ada_symbol_info *candidates; int n_candidates; @@ -4886,40 +4885,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block0, if (block_found != NULL) *block_found = candidates[0].block; - if (symtab != NULL) - { - *symtab = candidates[0].symtab; - if (*symtab == NULL && candidates[0].block != NULL) - { - struct objfile *objfile; - struct symtab *s; - struct block *b; - struct blockvector *bv; - - /* Search the list of symtabs for one which contains the - address of the start of this block. */ - ALL_PRIMARY_SYMTABS (objfile, s) - { - bv = BLOCKVECTOR (s); - b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - if (BLOCK_START (b) <= BLOCK_START (candidates[0].block) - && BLOCK_END (b) > BLOCK_START (candidates[0].block)) - { - *symtab = s; - return fixup_symbol_section (candidates[0].sym, objfile); - } - } - /* FIXME: brobecker/2004-11-12: I think that we should never - reach this point. I don't see a reason why we would not - find a symtab for a given block, so I suggest raising an - internal_error exception here. Otherwise, we end up - returning a symbol but no symtab, which certain parts of - the code that rely (indirectly) on this function do not - expect, eventually causing a SEGV. */ - return fixup_symbol_section (candidates[0].sym, NULL); - } - } - return candidates[0].sym; + return fixup_symbol_section (candidates[0].sym, NULL); } /* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing @@ -4931,27 +4897,26 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block0, assignments occur only if the pointers are non-null). */ struct symbol * ada_lookup_symbol (const char *name, const struct block *block0, - domain_enum namespace, int *is_a_field_of_this, - struct symtab **symtab) + domain_enum namespace, int *is_a_field_of_this) { if (is_a_field_of_this != NULL) *is_a_field_of_this = 0; return ada_lookup_encoded_symbol (ada_encode (ada_fold_name (name)), - block0, namespace, NULL, symtab); + block0, namespace, NULL); } static struct symbol * ada_lookup_symbol_nonlocal (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, struct symtab **symtab) + const domain_enum domain) { if (linkage_name == NULL) linkage_name = name; return ada_lookup_symbol (linkage_name, block_static_block (block), domain, - NULL, symtab); + NULL); } diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index c2d08c39a67..56115731767 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -318,13 +318,11 @@ extern int ada_lookup_symbol_list (const char *, const struct block *, extern char *ada_fold_name (const char *); extern struct symbol *ada_lookup_symbol (const char *, const struct block *, - domain_enum, int *, - struct symtab **); + domain_enum, int *); extern struct symbol * ada_lookup_encoded_symbol (const char *, const struct block *, - domain_enum namespace, - struct block **, struct symtab **); + domain_enum namespace, struct block **); extern struct minimal_symbol *ada_lookup_simple_minsym (const char *); diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 9b3dd812c17..9c7ea599a96 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -73,7 +73,6 @@ static struct symbol *lookup_namespace_scope (const char *name, const char *linkage_name, const struct block *block, const domain_enum domain, - struct symtab **symtab, const char *scope, int scope_len); @@ -81,7 +80,6 @@ static struct symbol *lookup_symbol_file (const char *name, const char *linkage_name, const struct block *block, const domain_enum domain, - struct symtab **symtab, int anonymous_namespace); static struct type *cp_lookup_transparent_type_loop (const char *name, @@ -102,9 +100,7 @@ static int check_one_possible_namespace_symbol (const char *name, int len, struct objfile *objfile); -static -struct symbol *lookup_possible_namespace_symbol (const char *name, - struct symtab **symtab); +static struct symbol *lookup_possible_namespace_symbol (const char *name); static void maintenance_cplus_namespace (char *args, int from_tty); @@ -333,11 +329,10 @@ struct symbol * cp_lookup_symbol_nonlocal (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { return lookup_namespace_scope (name, linkage_name, block, domain, - symtab, block_scope (block), 0); + block_scope (block), 0); } /* Lookup NAME at namespace scope (or, in C terms, in static and @@ -360,7 +355,6 @@ lookup_namespace_scope (const char *name, const char *linkage_name, const struct block *block, const domain_enum domain, - struct symtab **symtab, const char *scope, int scope_len) { @@ -381,8 +375,7 @@ lookup_namespace_scope (const char *name, } new_scope_len += cp_find_first_component (scope + new_scope_len); sym = lookup_namespace_scope (name, linkage_name, block, - domain, symtab, - scope, new_scope_len); + domain, scope, new_scope_len); if (sym != NULL) return sym; } @@ -394,7 +387,7 @@ lookup_namespace_scope (const char *name, strncpy (namespace, scope, scope_len); namespace[scope_len] = '\0'; return cp_lookup_symbol_namespace (namespace, name, linkage_name, - block, domain, symtab); + block, domain); } /* Look up NAME in the C++ namespace NAMESPACE, applying the using @@ -406,8 +399,7 @@ cp_lookup_symbol_namespace (const char *namespace, const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { const struct using_direct *current; struct symbol *sym; @@ -426,8 +418,7 @@ cp_lookup_symbol_namespace (const char *namespace, name, linkage_name, block, - domain, - symtab); + domain); if (sym != NULL) return sym; } @@ -440,7 +431,7 @@ cp_lookup_symbol_namespace (const char *namespace, if (namespace[0] == '\0') { return lookup_symbol_file (name, linkage_name, block, - domain, symtab, 0); + domain, 0); } else { @@ -450,7 +441,7 @@ cp_lookup_symbol_namespace (const char *namespace, strcat (concatenated_name, "::"); strcat (concatenated_name, name); sym = lookup_symbol_file (concatenated_name, linkage_name, - block, domain, symtab, + block, domain, cp_is_anonymous (namespace)); return sym; } @@ -466,12 +457,11 @@ lookup_symbol_file (const char *name, const char *linkage_name, const struct block *block, const domain_enum domain, - struct symtab **symtab, int anonymous_namespace) { struct symbol *sym = NULL; - sym = lookup_symbol_static (name, linkage_name, block, domain, symtab); + sym = lookup_symbol_static (name, linkage_name, block, domain); if (sym != NULL) return sym; @@ -485,11 +475,11 @@ lookup_symbol_file (const char *name, if (global_block != NULL) sym = lookup_symbol_aux_block (name, linkage_name, global_block, - domain, symtab); + domain); } else { - sym = lookup_symbol_global (name, linkage_name, block, domain, symtab); + sym = lookup_symbol_global (name, linkage_name, block, domain); } if (sym != NULL) @@ -507,7 +497,7 @@ lookup_symbol_file (const char *name, if (domain == VAR_DOMAIN) { - sym = lookup_possible_namespace_symbol (name, symtab); + sym = lookup_possible_namespace_symbol (name); if (sym != NULL) return sym; } @@ -541,8 +531,7 @@ cp_lookup_nested_type (struct type *parent_type, nested_name, NULL, block, - VAR_DOMAIN, - NULL); + VAR_DOMAIN); if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF) return NULL; else @@ -814,11 +803,10 @@ check_one_possible_namespace_symbol (const char *name, int len, } /* Look for a symbol named NAME in all the possible namespace blocks. - If one is found, return it; if SYMTAB is non-NULL, set *SYMTAB to - equal the symtab where it was found. */ + If one is found, return it. */ static struct symbol * -lookup_possible_namespace_symbol (const char *name, struct symtab **symtab) +lookup_possible_namespace_symbol (const char *name) { struct objfile *objfile; @@ -830,12 +818,7 @@ lookup_possible_namespace_symbol (const char *name, struct symtab **symtab) name, NULL, VAR_DOMAIN); if (sym != NULL) - { - if (symtab != NULL) - *symtab = objfile->cp_namespace_symtab; - - return sym; - } + return sym; } return NULL; diff --git a/gdb/cp-support.h b/gdb/cp-support.h index f52154b3ab2..8c0119ee8d5 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -96,15 +96,13 @@ extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol); extern struct symbol *cp_lookup_symbol_nonlocal (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); extern struct symbol *cp_lookup_symbol_namespace (const char *namespace, const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); extern struct type *cp_lookup_nested_type (struct type *parent_type, const char *nested_name, diff --git a/gdb/language.h b/gdb/language.h index 233a5a39b9a..8bdc212a81d 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -218,8 +218,7 @@ struct language_defn struct symbol *(*la_lookup_symbol_nonlocal) (const char *, const char *, const struct block *, - const domain_enum, - struct symtab **); + const domain_enum); /* Find the definition of the type with the given name. */ struct type *(*la_lookup_transparent_type) (const char *); diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index a80a61a6d53..746bd0320b9 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -59,13 +59,9 @@ scm_inferior_print (LONGEST value, struct ui_file *stream, int format, { /* XXX: Should we cache these symbols? */ gdb_output_sym = - lookup_symbol_global ("gdb_output", NULL, NULL, - VAR_DOMAIN, - (struct symtab **) NULL); + lookup_symbol_global ("gdb_output", NULL, NULL, VAR_DOMAIN); gdb_output_len_sym = - lookup_symbol_global ("gdb_output_length", NULL, NULL, - VAR_DOMAIN, - (struct symtab **) NULL); + lookup_symbol_global ("gdb_output_length", NULL, NULL, VAR_DOMAIN); if ((gdb_output_sym == NULL) || (gdb_output_len_sym == NULL)) ret = -1; diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index d4d321339bb..5a0135b088f 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1658,14 +1658,14 @@ static struct symbol * elf_lookup_lib_symbol (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, struct symtab **symtab) + const domain_enum domain) { if (objfile->obfd == NULL || scan_dyntag (DT_SYMBOLIC, objfile->obfd, NULL) != 1) return NULL; return lookup_global_symbol_from_objfile - (objfile, name, linkage_name, domain, symtab); + (objfile, name, linkage_name, domain); } extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ diff --git a/gdb/solib.c b/gdb/solib.c index 69680b455cb..a694b813307 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -971,14 +971,12 @@ struct symbol * solib_global_lookup (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct target_so_ops *ops = solib_ops (current_gdbarch); if (ops->lookup_lib_global_symbol != NULL) - return ops->lookup_lib_global_symbol (objfile, name, linkage_name, - domain, symtab); + return ops->lookup_lib_global_symbol (objfile, name, linkage_name, domain); return NULL; } diff --git a/gdb/solist.h b/gdb/solist.h index 01f734fcdad..fb104b49db8 100644 --- a/gdb/solist.h +++ b/gdb/solist.h @@ -112,8 +112,7 @@ struct target_so_ops struct symbol * (*lookup_lib_global_symbol) (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); /* Given two so_list objects, one from the GDB thread list and another from the list returned by current_sos, return 1 @@ -137,7 +136,6 @@ extern struct target_so_ops *current_target_so_ops; struct symbol *solib_global_lookup (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); #endif diff --git a/gdb/symtab.c b/gdb/symtab.c index 33efe129239..db0808bba4a 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -86,29 +86,25 @@ static struct symbol *lookup_symbol_aux (const char *name, const struct block *block, const domain_enum domain, enum language language, - int *is_a_field_of_this, - struct symtab **symtab); + int *is_a_field_of_this); static struct symbol *lookup_symbol_aux_local (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); static struct symbol *lookup_symbol_aux_symtabs (int block_index, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); static struct symbol *lookup_symbol_aux_psymtabs (int block_index, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); static int file_matches (char *, char **, int); @@ -1243,8 +1239,7 @@ lookup_symbol_in_language (const char *name, const struct block *block, } returnval = lookup_symbol_aux (modified_name, mangled_name, block, - domain, lang, - is_a_field_of_this, symtab); + domain, lang, is_a_field_of_this); if (needtofreename) xfree (demangled_name); @@ -1276,8 +1271,7 @@ lookup_symbol (const char *name, const struct block *block, static struct symbol * lookup_symbol_aux (const char *name, const char *linkage_name, const struct block *block, const domain_enum domain, - enum language language, - int *is_a_field_of_this, struct symtab **symtab) + enum language language, int *is_a_field_of_this) { struct symbol *sym; const struct language_defn *langdef; @@ -1293,8 +1287,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name, /* Search specified block and its superiors. Don't search STATIC_BLOCK or GLOBAL_BLOCK. */ - sym = lookup_symbol_aux_local (name, linkage_name, block, domain, - symtab); + sym = lookup_symbol_aux_local (name, linkage_name, block, domain); if (sym != NULL) return sym; @@ -1334,8 +1327,6 @@ lookup_symbol_aux (const char *name, const char *linkage_name, if (check_field (t, name)) { *is_a_field_of_this = 1; - if (symtab != NULL) - *symtab = NULL; return NULL; } } @@ -1344,8 +1335,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name, /* Now do whatever is appropriate for LANGUAGE to look up static and global variables. */ - sym = langdef->la_lookup_symbol_nonlocal (name, linkage_name, - block, domain, symtab); + sym = langdef->la_lookup_symbol_nonlocal (name, linkage_name, block, domain); if (sym != NULL) return sym; @@ -1355,18 +1345,14 @@ lookup_symbol_aux (const char *name, const char *linkage_name, desired name as a file-level static, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ - sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, linkage_name, - domain, symtab); + sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, linkage_name, domain); if (sym != NULL) return sym; - sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, linkage_name, - domain, symtab); + sym = lookup_symbol_aux_psymtabs (STATIC_BLOCK, name, linkage_name, domain); if (sym != NULL) return sym; - if (symtab != NULL) - *symtab = NULL; return NULL; } @@ -1376,8 +1362,7 @@ lookup_symbol_aux (const char *name, const char *linkage_name, static struct symbol * lookup_symbol_aux_local (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; const struct block *static_block = block_static_block (block); @@ -1389,8 +1374,7 @@ lookup_symbol_aux_local (const char *name, const char *linkage_name, while (block != static_block) { - sym = lookup_symbol_aux_block (name, linkage_name, block, domain, - symtab); + sym = lookup_symbol_aux_block (name, linkage_name, block, domain); if (sym != NULL) return sym; block = BLOCK_SUPERBLOCK (block); @@ -1427,36 +1411,15 @@ lookup_objfile_from_block (const struct block *block) struct symbol * lookup_symbol_aux_block (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; - struct objfile *objfile = NULL; - struct blockvector *bv; - struct block *b; - struct symtab *s = NULL; sym = lookup_block_symbol (block, name, linkage_name, domain); if (sym) { block_found = block; - if (symtab != NULL) - { - /* Search the list of symtabs for one which contains the - address of the start of this block. */ - ALL_PRIMARY_SYMTABS (objfile, s) - { - bv = BLOCKVECTOR (s); - b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - if (BLOCK_START (b) <= BLOCK_START (block) - && BLOCK_END (b) > BLOCK_START (block)) - goto found; - } - found: - *symtab = s; - } - - return fixup_symbol_section (sym, objfile); + return fixup_symbol_section (sym, NULL); } return NULL; @@ -1469,8 +1432,7 @@ struct symbol * lookup_global_symbol_from_objfile (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; struct blockvector *bv; @@ -1487,8 +1449,6 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, if (sym) { block_found = block; - if (symtab != NULL) - *symtab = s; return fixup_symbol_section (sym, (struct objfile *)objfile); } } @@ -1504,16 +1464,13 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); sym = lookup_block_symbol (block, name, linkage_name, domain); - if (symtab != NULL) - *symtab = s; return fixup_symbol_section (sym, (struct objfile *)objfile); } } if (objfile->separate_debug_objfile) return lookup_global_symbol_from_objfile (objfile->separate_debug_objfile, - name, linkage_name, domain, - symtab); + name, linkage_name, domain); return NULL; } @@ -1526,8 +1483,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, static struct symbol * lookup_symbol_aux_symtabs (int block_index, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; struct objfile *objfile; @@ -1543,8 +1499,6 @@ lookup_symbol_aux_symtabs (int block_index, if (sym) { block_found = block; - if (symtab != NULL) - *symtab = s; return fixup_symbol_section (sym, objfile); } } @@ -1560,8 +1514,7 @@ lookup_symbol_aux_symtabs (int block_index, static struct symbol * lookup_symbol_aux_psymtabs (int block_index, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; struct objfile *objfile; @@ -1603,8 +1556,6 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, block_index == GLOBAL_BLOCK ? "global" : "static", name, ps->filename, name, name); } - if (symtab != NULL) - *symtab = s; return fixup_symbol_section (sym, objfile); } } @@ -1620,8 +1571,7 @@ struct symbol * basic_lookup_symbol_nonlocal (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym; @@ -1653,11 +1603,11 @@ basic_lookup_symbol_nonlocal (const char *name, than that one, so I don't think we should worry about that for now. */ - sym = lookup_symbol_static (name, linkage_name, block, domain, symtab); + sym = lookup_symbol_static (name, linkage_name, block, domain); if (sym != NULL) return sym; - return lookup_symbol_global (name, linkage_name, block, domain, symtab); + return lookup_symbol_global (name, linkage_name, block, domain); } /* Lookup a symbol in the static block associated to BLOCK, if there @@ -1667,14 +1617,12 @@ struct symbol * lookup_symbol_static (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { const struct block *static_block = block_static_block (block); if (static_block != NULL) - return lookup_symbol_aux_block (name, linkage_name, static_block, - domain, symtab); + return lookup_symbol_aux_block (name, linkage_name, static_block, domain); else return NULL; } @@ -1686,8 +1634,7 @@ struct symbol * lookup_symbol_global (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab) + const domain_enum domain) { struct symbol *sym = NULL; struct objfile *objfile = NULL; @@ -1695,17 +1642,15 @@ lookup_symbol_global (const char *name, /* Call library-specific lookup procedure. */ objfile = lookup_objfile_from_block (block); if (objfile != NULL) - sym = solib_global_lookup (objfile, name, linkage_name, domain, symtab); + sym = solib_global_lookup (objfile, name, linkage_name, domain); if (sym != NULL) return sym; - sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, linkage_name, - domain, symtab); + sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, linkage_name, domain); if (sym != NULL) return sym; - return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, linkage_name, - domain, symtab); + return lookup_symbol_aux_psymtabs (GLOBAL_BLOCK, name, linkage_name, domain); } int diff --git a/gdb/symtab.h b/gdb/symtab.h index 37ce3f4d612..0a970dfbfe2 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1028,8 +1028,7 @@ extern struct symbol *lookup_symbol (const char *, const struct block *, extern struct symbol *basic_lookup_symbol_nonlocal (const char *, const char *, const struct block *, - const domain_enum, - struct symtab **); + const domain_enum); /* Some helper functions for languages that need to write their own lookup_symbol_nonlocal functions. */ @@ -1040,8 +1039,7 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *, extern struct symbol *lookup_symbol_static (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); /* Lookup a symbol in all files' global blocks (searching psymtabs if necessary). */ @@ -1049,8 +1047,7 @@ extern struct symbol *lookup_symbol_static (const char *name, extern struct symbol *lookup_symbol_global (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); /* Lookup a symbol within the block BLOCK. This, unlike lookup_symbol_block, will set SYMTAB and BLOCK_FOUND correctly, and @@ -1059,8 +1056,7 @@ extern struct symbol *lookup_symbol_global (const char *name, extern struct symbol *lookup_symbol_aux_block (const char *name, const char *linkage_name, const struct block *block, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); /* Lookup a partial symbol. */ @@ -1391,8 +1387,7 @@ extern /*const */ char *main_name (void); struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile, const char *name, const char *linkage_name, - const domain_enum domain, - struct symtab **symtab); + const domain_enum domain); extern struct symtabs_and_lines expand_line_sal (struct symtab_and_line sal); diff --git a/gdb/valops.c b/gdb/valops.c index d601974fba9..0d1bcc5c471 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2705,7 +2705,7 @@ value_maybe_namespace_elt (const struct type *curtype, sym = cp_lookup_symbol_namespace (namespace_name, name, NULL, get_selected_block (0), - VAR_DOMAIN, NULL); + VAR_DOMAIN); if (sym == NULL) return NULL;