diff options
author | Tom Tromey <tromey@redhat.com> | 2013-04-08 19:56:03 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-04-08 19:56:03 +0000 |
commit | f85f34ede85d0c306e689736c6694caa2f0a0f78 (patch) | |
tree | ee949d9e14ec31108f42d2aaea4113f6d4972943 /gdb/ada-lang.c | |
parent | ccde22c0a47c50f54635b7b9fcbf5ddc19cdf9ca (diff) | |
download | gdb-f85f34ede85d0c306e689736c6694caa2f0a0f78.zip gdb-f85f34ede85d0c306e689736c6694caa2f0a0f78.tar.gz gdb-f85f34ede85d0c306e689736c6694caa2f0a0f78.tar.bz2 |
* ada-lang.c (ada_decode_symbol): Check and set 'ada_mangled'.
Use symbol's obstack, not an objfile.
* coffread.c (process_coff_symbol): Update.
* dwarf2read.c (fixup_go_packaging, new_symbol_full): Update.
* jv-lang.c (add_class_symbol): Update.
* mdebugread.c (new_symbol): Update.
* minsyms.c (prim_record_minimal_symbol_full)
(terminate_minimal_symbol_table): Update.
* psymtab.c (add_psymbol_to_bcache): Clear entire symbol. Update.
* stabsread.c (define_symbol, read_enum_type): Update.
* symtab.c (symbol_set_demangled_name, symbol_get_demangled_name):
Handle Ada specially.
(symbol_set_language): Add 'obstack' argument.
(symbol_set_names): Update.
(symbol_natural_name, symbol_demangled_name): Always use
ada_decode_symbol.
* symtab.h (struct general_symbol_info)
<language_specific::obstack>: New field.
<ada_mangled>: New field.
(SYMBOL_SET_LANGUAGE): Add 'obstack' argument.
(symbol_set_language): Update.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 43d6e3c..0329dd9 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1297,30 +1297,28 @@ static struct htab *decoded_names_store; when a decoded name is cached in it. */ const char * -ada_decode_symbol (const struct general_symbol_info *gsymbol) +ada_decode_symbol (const struct general_symbol_info *arg) { - struct general_symbol_info *gsymbol_rw - = (struct general_symbol_info *) gsymbol; - const char **resultp - = &gsymbol_rw->language_specific.mangled_lang.demangled_name; + struct general_symbol_info *gsymbol = (struct general_symbol_info *) arg; + const char **resultp = + &gsymbol->language_specific.mangled_lang.demangled_name; - if (*resultp == NULL) + if (!gsymbol->ada_mangled) { const char *decoded = ada_decode (gsymbol->name); + struct obstack *obstack = gsymbol->language_specific.obstack; - if (gsymbol->obj_section != NULL) - { - struct objfile *objf = gsymbol->obj_section->objfile; + gsymbol->ada_mangled = 1; - *resultp = obstack_copy0 (&objf->objfile_obstack, - decoded, strlen (decoded)); - } - /* Sometimes, we can't find a corresponding objfile, in which - case, we put the result on the heap. Since we only decode - when needed, we hope this usually does not cause a - significant memory leak (FIXME). */ - if (*resultp == NULL) + if (obstack != NULL) + *resultp = obstack_copy0 (obstack, decoded, strlen (decoded)); + else { + /* Sometimes, we can't find a corresponding objfile, in + which case, we put the result on the heap. Since we only + decode when needed, we hope this usually does not cause a + significant memory leak (FIXME). */ + char **slot = (char **) htab_find_slot (decoded_names_store, decoded, INSERT); |