diff options
author | Daniel Jacobowitz <drow@false.org> | 2003-02-04 18:07:01 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2003-02-04 18:07:01 +0000 |
commit | 2de7ced7074964728e66d7a71af0d4fb28f28fa9 (patch) | |
tree | 13fb1875f9f0b42bc9ac58a32d828fefb6e7ad11 /gdb/stabsread.c | |
parent | 266fb683100e69fad79f5bb7ed260de5e2eff655 (diff) | |
download | gdb-2de7ced7074964728e66d7a71af0d4fb28f28fa9.zip gdb-2de7ced7074964728e66d7a71af0d4fb28f28fa9.tar.gz gdb-2de7ced7074964728e66d7a71af0d4fb28f28fa9.tar.bz2 |
* defs.h (streq): Add prototype.
* utils.c (streq): New function.
* dwarf2read.c (new_symbol): Use SYMBOL_SET_NAMES instead of
SYMBOL_NAME and SYMBOL_INIT_DEMANGLED_NAME.
* mdebugread.c (new_symbol): Likewise.
* stabsread.c (define_symbol): Likewise.
* coffread.c (process_coff_symbol): Likewise.
* dwarfread.c (new_symbol): Likewise.
* minsyms.c (prim_record_minimal_symbol_and_info): Use
SYMBOL_SET_NAMES instead of setting SYMBOL_NAME. Set the language
here.
(install_minimal_symbols): Don't set SYMBOL_LANGUAGE or call
SYMBOL_INIT_DEMANGLED_NAME.
* objfiles.c: Include "hashtab.h".
(allocate_objfile): Call htab_set_functions_ex for the
demangled_names_hash.
(free_objfile): Call htab_delete for the demangled_names_hash.
* objfiles.h (struct htab): Add declaration.
(struct objfile): Add demangled_names_hash.
* symfile.c: Include "hashtab.h".
(reread_symbols): Call htab_delete for the demangled_names_hash.
(add_psymbol_to_list): Use SYMBOL_SET_NAMES instead of putting
SYMBOL_NAME in the bcache.
* symtab.c: Include "hashtab.h". Update comments.
(create_demangled_names_hash, symbol_set_names): New functions.
(symbol_find_demangled_name): New function, broken out from
symbol_init_demangled_names.
(symbol_init_demangled_names): Use it.
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Add missing parentheses.
(SYMBOL_SET_NAMES): New macro.
(symbol_set_names): Add prototype.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r-- | gdb/stabsread.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c index b873be6..0afd6d5 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1329,23 +1329,13 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, if (refnum >= 0) { if (nlen > 0) - { - SYMBOL_NAME (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, nlen); - strncpy (SYMBOL_NAME (sym), s, nlen); - SYMBOL_NAME (sym)[nlen] = '\0'; - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); - } + SYMBOL_SET_NAMES (sym, s, nlen, objfile); else /* FIXME! Want SYMBOL_NAME (sym) = 0; Get error if leave name 0. So give it something. */ { nlen = p - string; - SYMBOL_NAME (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, nlen); - strncpy (SYMBOL_NAME (sym), string, nlen); - SYMBOL_NAME (sym)[nlen] = '\0'; - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_SET_NAMES (sym, string, nlen, objfile); } } /* Advance STRING beyond the reference id. */ @@ -1355,29 +1345,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { normal: SYMBOL_LANGUAGE (sym) = current_subfile->language; - SYMBOL_NAME (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, ((p - string) + 1)); - /* Open-coded memcpy--saves function call time. */ - /* FIXME: Does it really? Try replacing with simple strcpy and - try it on an executable with a large symbol table. */ - /* FIXME: considering that gcc can open code memcpy anyway, I - doubt it. xoxorich. */ - { - register char *p1 = string; - register char *p2 = SYMBOL_NAME (sym); - while (p1 != p) - { - *p2++ = *p1++; - } - *p2++ = '\0'; - } - - /* If this symbol is from a C++ compilation, then attempt to cache the - demangled form for future reference. This is a typical time versus - space tradeoff, that was decided in favor of time because it sped up - C++ symbol lookups by a factor of about 20. */ - - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_SET_NAMES (sym, string, p - string, objfile); } p++; |