From f61e8913ab490a3f00c43cdec07f2354f4b9a294 Mon Sep 17 00:00:00 2001 From: David Carlton Date: Thu, 5 Dec 2002 21:07:49 +0000 Subject: [PATCH] 2002-12-05 David Carlton * symtab.c (lookup_symbol_aux_block): New function. (lookup_symbol_aux_local): Move code into lookup_symbol_aux_block. --- gdb/ChangeLog | 5 ++++ gdb/symtab.c | 74 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51fa80e210..808548abbc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-12-05 David Carlton + + * symtab.c (lookup_symbol_aux_block): New function. + (lookup_symbol_aux_local): Move code into lookup_symbol_aux_block. + 2002-12-05 Andrew Cagney * gdbarch.sh: Dump the predicate function and macro values. diff --git a/gdb/symtab.c b/gdb/symtab.c index a891d35661..53c1f082bf 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -89,6 +89,13 @@ static struct symbol *lookup_symbol_aux_local (const char *name, const namespace_enum namespace, struct symtab **symtab); +static +struct symbol *lookup_symbol_aux_block (const char *name, + const char *mangled_name, + const struct block *block, + const namespace_enum namespace, + struct symtab **symtab); + static struct symbol *lookup_symbol_aux_symtabs (int block_index, const char *name, @@ -964,36 +971,55 @@ lookup_symbol_aux_local (const char *name, const char *mangled_name, struct symtab **symtab) { struct symbol *sym; + + while (block != 0) + { + sym = lookup_symbol_aux_block (name, mangled_name, block, namespace, + symtab); + if (sym != NULL) + return sym; + block = BLOCK_SUPERBLOCK (block); + } + + return NULL; +} + +/* Look up a symbol in a block; if found, locate its symtab, fixup the + symbol, and set block_found appropriately. */ + +static struct symbol * +lookup_symbol_aux_block (const char *name, const char *mangled_name, + const struct block *block, + const namespace_enum namespace, + struct symtab **symtab) +{ + struct symbol *sym; struct objfile *objfile = NULL; struct blockvector *bv; struct block *b; struct symtab *s = NULL; - - while (block != 0) - { - sym = lookup_block_symbol (block, name, mangled_name, namespace); - 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_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); + sym = lookup_block_symbol (block, name, mangled_name, namespace); + 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_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; } - block = BLOCK_SUPERBLOCK (block); + + return fixup_symbol_section (sym, objfile); } return NULL;