[rfc] [1/2] Remove SYMTAB argument from lookup_symbol functions
Ulrich Weigand
uweigand@de.ibm.com
Sat May 17 05:44:00 GMT 2008
Hello,
in recent discussions we noticed that passing the SYMTAB parameter in
the family of lookup_symbol_ functions is basically pointless, because
whatever this is set to gets overwritten in lookup_symbol_in_language:
/* Override the returned symtab with the symbol's specific one. */
if (returnval != NULL && symtab != NULL)
*symtab = SYMBOL_SYMTAB (returnval);
This patch removes the SYMTAB parameter in all functions "downstream"
from lookup_symbol_in_language. The only difference in behaviour is
that in some cases, fixup_symbol_section is now called with a NULL
objfile. However, this should not hurt as fixup_symbol_section will
now use SYMBOL_SYMTAB to get at the symbol's objfile ...
Tested (together with part 2) on spu-elf, powerpc-linux, powerpc64-linux
with no regressions.
Bye,
Ulrich
ChangeLog:
* 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 -urNp gdb-orig/gdb/ada-exp.y gdb-head/gdb/ada-exp.y
--- gdb-orig/gdb/ada-exp.y 2008-04-17 15:52:45.000000000 +0200
+++ gdb-head/gdb/ada-exp.y 2008-05-15 16:48:28.000000000 +0200
@@ -869,7 +869,7 @@ write_object_renaming (struct block *ori
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 *ori
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 -urNp gdb-orig/gdb/ada-lang.c gdb-head/gdb/ada-lang.c
--- gdb-orig/gdb/ada-lang.c 2008-05-15 16:14:42.000000000 +0200
+++ gdb-head/gdb/ada-lang.c 2008-05-15 17:02:11.000000000 +0200
@@ -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 *n
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 *n
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 -urNp gdb-orig/gdb/ada-lang.h gdb-head/gdb/ada-lang.h
--- gdb-orig/gdb/ada-lang.h 2008-02-06 18:20:50.000000000 +0100
+++ gdb-head/gdb/ada-lang.h 2008-05-15 16:48:12.000000000 +0200
@@ -318,13 +318,11 @@ extern int ada_lookup_symbol_list (const
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 -urNp gdb-orig/gdb/cp-namespace.c gdb-head/gdb/cp-namespace.c
--- gdb-orig/gdb/cp-namespace.c 2008-01-14 15:01:04.000000000 +0100
+++ gdb-head/gdb/cp-namespace.c 2008-05-15 16:51:00.000000000 +0200
@@ -73,7 +73,6 @@ static struct symbol *lookup_namespace_s
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 *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_
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 *
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 *
name,
linkage_name,
block,
- domain,
- symtab);
+ domain);
if (sym != NULL)
return sym;
}
@@ -440,7 +431,7 @@ cp_lookup_symbol_namespace (const char *
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 *
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 *pare
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 (con
}
/* 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
name, NULL, VAR_DOMAIN);
if (sym != NULL)
- {
- if (symtab != NULL)
- *symtab = objfile->cp_namespace_symtab;
-
- return sym;
- }
+ return sym;
}
return NULL;
diff -urNp gdb-orig/gdb/cp-support.h gdb-head/gdb/cp-support.h
--- gdb-orig/gdb/cp-support.h 2008-05-09 19:20:21.000000000 +0200
+++ gdb-head/gdb/cp-support.h 2008-05-15 16:24:28.000000000 +0200
@@ -96,15 +96,13 @@ extern void cp_scan_for_anonymous_namesp
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 -urNp gdb-orig/gdb/language.h gdb-head/gdb/language.h
--- gdb-orig/gdb/language.h 2008-04-17 15:53:11.000000000 +0200
+++ gdb-head/gdb/language.h 2008-05-15 16:19:37.000000000 +0200
@@ -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 -urNp gdb-orig/gdb/scm-valprint.c gdb-head/gdb/scm-valprint.c
--- gdb-orig/gdb/scm-valprint.c 2008-05-09 19:20:23.000000000 +0200
+++ gdb-head/gdb/scm-valprint.c 2008-05-15 16:34:46.000000000 +0200
@@ -59,13 +59,9 @@ scm_inferior_print (LONGEST value, struc
{
/* 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 -urNp gdb-orig/gdb/solib.c gdb-head/gdb/solib.c
--- gdb-orig/gdb/solib.c 2008-04-21 15:11:23.000000000 +0200
+++ gdb-head/gdb/solib.c 2008-05-15 16:54:00.000000000 +0200
@@ -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 -urNp gdb-orig/gdb/solib-svr4.c gdb-head/gdb/solib-svr4.c
--- gdb-orig/gdb/solib-svr4.c 2008-04-17 15:52:45.000000000 +0200
+++ gdb-head/gdb/solib-svr4.c 2008-05-15 16:54:39.000000000 +0200
@@ -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 -urNp gdb-orig/gdb/solist.h gdb-head/gdb/solist.h
--- gdb-orig/gdb/solist.h 2008-01-14 15:01:10.000000000 +0100
+++ gdb-head/gdb/solist.h 2008-05-15 16:54:12.000000000 +0200
@@ -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_tar
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 -urNp gdb-orig/gdb/symtab.c gdb-head/gdb/symtab.c
--- gdb-orig/gdb/symtab.c 2008-05-09 19:20:23.000000000 +0200
+++ gdb-head/gdb/symtab.c 2008-05-15 17:00:52.000000000 +0200
@@ -86,29 +86,25 @@ static struct symbol *lookup_symbol_aux
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 void fixup_section (struct general_symbol_info *, struct objfile *);
@@ -1185,8 +1181,7 @@ lookup_symbol_in_language (const char *n
}
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);
@@ -1218,8 +1213,7 @@ lookup_symbol (const char *name, const s
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;
@@ -1235,8 +1229,7 @@ lookup_symbol_aux (const char *name, con
/* 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;
@@ -1276,8 +1269,6 @@ lookup_symbol_aux (const char *name, con
if (check_field (t, name))
{
*is_a_field_of_this = 1;
- if (symtab != NULL)
- *symtab = NULL;
return NULL;
}
}
@@ -1286,8 +1277,7 @@ lookup_symbol_aux (const char *name, con
/* 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;
@@ -1297,18 +1287,14 @@ lookup_symbol_aux (const char *name, con
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;
}
@@ -1318,8 +1304,7 @@ lookup_symbol_aux (const char *name, con
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);
@@ -1331,8 +1316,7 @@ lookup_symbol_aux_local (const char *nam
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);
@@ -1369,36 +1353,15 @@ lookup_objfile_from_block (const struct
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;
@@ -1411,8 +1374,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;
@@ -1429,8 +1391,6 @@ lookup_global_symbol_from_objfile (const
if (sym)
{
block_found = block;
- if (symtab != NULL)
- *symtab = s;
return fixup_symbol_section (sym, (struct objfile *)objfile);
}
}
@@ -1446,16 +1406,13 @@ lookup_global_symbol_from_objfile (const
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;
}
@@ -1468,8 +1425,7 @@ lookup_global_symbol_from_objfile (const
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;
@@ -1485,8 +1441,6 @@ lookup_symbol_aux_symtabs (int block_ind
if (sym)
{
block_found = block;
- if (symtab != NULL)
- *symtab = s;
return fixup_symbol_section (sym, objfile);
}
}
@@ -1502,8 +1456,7 @@ lookup_symbol_aux_symtabs (int block_ind
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;
@@ -1545,8 +1498,6 @@ lookup_symbol_aux_psymtabs (int block_in
block_index == GLOBAL_BLOCK ? "global" : "static",
name, ps->filename, name, name);
}
- if (symtab != NULL)
- *symtab = s;
return fixup_symbol_section (sym, objfile);
}
}
@@ -1562,8 +1513,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;
@@ -1595,11 +1545,11 @@ basic_lookup_symbol_nonlocal (const char
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
@@ -1609,14 +1559,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;
}
@@ -1628,8 +1576,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;
@@ -1637,17 +1584,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 -urNp gdb-orig/gdb/symtab.h gdb-head/gdb/symtab.h
--- gdb-orig/gdb/symtab.h 2008-05-09 19:20:23.000000000 +0200
+++ gdb-head/gdb/symtab.h 2008-05-15 16:54:52.000000000 +0200
@@ -1028,8 +1028,7 @@ extern struct symbol *lookup_symbol (con
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_symbo
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_stat
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_glob
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. */
@@ -1388,8 +1384,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 -urNp gdb-orig/gdb/valops.c gdb-head/gdb/valops.c
--- gdb-orig/gdb/valops.c 2008-05-09 19:20:23.000000000 +0200
+++ gdb-head/gdb/valops.c 2008-05-15 16:23:50.000000000 +0200
@@ -2705,7 +2705,7 @@ value_maybe_namespace_elt (const struct
sym = cp_lookup_symbol_namespace (namespace_name, name, NULL,
get_selected_block (0),
- VAR_DOMAIN, NULL);
+ VAR_DOMAIN);
if (sym == NULL)
return NULL;
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list