diff options
author | David Carlton <carlton@bactrian.org> | 2003-06-11 22:27:17 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-06-11 22:27:17 +0000 |
commit | 526e70c05f9132dc0a15af67943d2ecf9120660e (patch) | |
tree | 45a01e57386fa45d0b48c6a524a250ff68fb22b5 /gdb/symtab.c | |
parent | 33c081509ef98f9ea2702cb8e6150e0bbf277ab2 (diff) | |
download | gdb-526e70c05f9132dc0a15af67943d2ecf9120660e.zip gdb-526e70c05f9132dc0a15af67943d2ecf9120660e.tar.gz gdb-526e70c05f9132dc0a15af67943d2ecf9120660e.tar.bz2 |
2003-06-11 David Carlton <carlton@bactrian.org>
* block.h (BLOCK_SHOULD_SORT): Delete.
* symtab.c (lookup_block_symbol): Don't worry about sorted linear
blocks.
* ada-lang.c (ada_add_block_symbols): Ditto.
* symfile.c (sort_block_syms): Delete.
(sort_symtab_syms): Ditto.
* symfile.h: Delete sort_symtabs_syms and sort_block_syms
declarations.
* coffread.c (coff_symfile_read): Don't call sort_symtab_syms.
* dbxread.c (dbx_psymtab_to_symtab_1): Ditto.
* dwarf2read.c (psymtab_to_symtab_1): Ditto.
* dwarfread.c (psymtab_to_symtab_1): Ditto.
* hpread.c (hpread_psymtab_to_symtab_1): Ditto.
* mdebugread.c (psymtab_to_symtab_1): Ditto.
* xcoffread.c (xcoff_psymtab_to_symtab_1): Ditto.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 101 |
1 files changed, 8 insertions, 93 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 1e1b5de..b580c2d 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1636,7 +1636,6 @@ lookup_block_symbol (register const struct block *block, const char *name, register int bot, top, inc; register struct symbol *sym; register struct symbol *sym_found = NULL; - register int do_linear_search = 1; if (BLOCK_HASHTABLE (block)) { @@ -1653,98 +1652,13 @@ lookup_block_symbol (register const struct block *block, const char *name, } return NULL; } - - /* If the blocks's symbols were sorted, start with a binary search. */ - - if (BLOCK_SHOULD_SORT (block)) - { - /* Reset the linear search flag so if the binary search fails, we - won't do the linear search once unless we find some reason to - do so */ - - do_linear_search = 0; - top = BLOCK_NSYMS (block); - bot = 0; - - /* Advance BOT to not far before the first symbol whose name is NAME. */ - - while (1) - { - inc = (top - bot + 1); - /* No need to keep binary searching for the last few bits worth. */ - if (inc < 4) - { - break; - } - inc = (inc >> 1) + bot; - sym = BLOCK_SYM (block, inc); - if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java)) - { - do_linear_search = 1; - } - if (SYMBOL_NATURAL_NAME (sym)[0] < name[0]) - { - bot = inc; - } - else if (SYMBOL_NATURAL_NAME (sym)[0] > name[0]) - { - top = inc; - } - else if (strcmp (SYMBOL_NATURAL_NAME (sym), name) < 0) - { - bot = inc; - } - else - { - top = inc; - } - } - - /* Now scan forward until we run out of symbols, find one whose - name is greater than NAME, or find one we want. If there is - more than one symbol with the right name and domain, we - return the first one; I believe it is now impossible for us - to encounter two symbols with the same name and domain - here, because blocks containing argument symbols are no - longer sorted. The exception is for C++, where multiple functions - (cloned constructors / destructors, in particular) can have - the same demangled name. So if we have a particular - mangled name to match, try to do so. */ - - top = BLOCK_NSYMS (block); - while (bot < top) - { - sym = BLOCK_SYM (block, bot); - if (SYMBOL_DOMAIN (sym) == domain - && (linkage_name - ? strcmp (DEPRECATED_SYMBOL_NAME (sym), linkage_name) == 0 - : SYMBOL_MATCHES_NATURAL_NAME (sym, name))) - { - return sym; - } - if (SYMBOL_PRINT_NAME (sym)[0] > name[0]) - { - break; - } - bot++; - } - } - - /* Here if block isn't sorted, or we fail to find a match during the - binary search above. If during the binary search above, we find a - symbol which is a Java symbol, then we have re-enabled the linear - search flag which was reset when starting the binary search. - - This loop is equivalent to the loop above, but hacked greatly for speed. - - Note that parameter symbols do not always show up last in the - list; this loop makes sure to take anything else other than - parameter symbols first; it only uses parameter symbols as a - last resort. Note that this only takes up extra computation - time on a match. */ - - if (do_linear_search) + else { + /* Note that parameter symbols do not always show up last in the + list; this loop makes sure to take anything else other than + parameter symbols first; it only uses parameter symbols as a + last resort. Note that this only takes up extra computation + time on a match. */ top = BLOCK_NSYMS (block); bot = 0; while (bot < top) @@ -1792,8 +1706,9 @@ lookup_block_symbol (register const struct block *block, const char *name, } bot++; } + + return (sym_found); /* Will be NULL if not found. */ } - return (sym_found); /* Will be NULL if not found. */ } /* Given a main symbol SYM and ADDR, search through the alias |