aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2014-12-02 16:54:16 -0800
committerDoug Evans <dje@google.com>2014-12-02 16:55:52 -0800
commit7c5fdd25ebe3262695084d93027f313e1015518a (patch)
tree450523fdb0bbe741db262a8c337792683b677247 /gdb
parent31c0ebfe8bfd9af65aee24cbff17fffe039c0b28 (diff)
downloadgdb-7c5fdd25ebe3262695084d93027f313e1015518a.zip
gdb-7c5fdd25ebe3262695084d93027f313e1015518a.tar.gz
gdb-7c5fdd25ebe3262695084d93027f313e1015518a.tar.bz2
Remove cplus_specific from general_symbol_info.
This patch reverts the addition of cplus_specific added here: 2010-07-16 Sami Wagiaalla <swagiaal@redhat.com> * symtab.h (symbol_set_demangled_name): Now takes an optional objfile* argument. (cplus_specific): New struct. * symtab.c (symbol_set_demangled_name): Updated. Use cplus_specific for cplus symbols. (symbol_get_demangled_name): Retrive the name from the cplus_specific struct for cplus symbols. (symbol_init_language_specific): Set cplus_specific for cplus symbols. (symbol_set_names): Pass objfile to symbol_set_demangled_name. * symtab.c (symbol_init_cplus_specific): New function. It was added in anticipation of improved template support: https://sourceware.org/ml/gdb-patches/2010-05/msg00594.html https://sourceware.org/ml/gdb-patches/2010-07/msg00284.html However, minsyms pay the price for this space too. For my standard benchmark this patch gets back 44MB of memory when gdb starts. [There's still ~440MB of memory used by the demangled ELF symbols of this benchmark, but that's another topic.] When the improved templated support is added, I wonder if this can be moved to struct symbol. Hmmm, we already have a special version of struct symbol for templates (struct template_symbol). gdb/ChangeLog: * symtab.c (symbol_init_cplus_specific): Delete. (symbol_set_demangled_name): Remove special c++ support. (symbol_get_demangled_name, symbol_set_language): Ditto. * symtab.h (struct cplus_specific): Delete. (struct general_symbol_info) <language_specific>: Remove cplus_specific.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/symtab.c43
-rw-r--r--gdb/symtab.h11
3 files changed, 15 insertions, 48 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9888369..f9c8148 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2014-12-02 Doug Evans <dje@google.com>
+ * symtab.c (symbol_init_cplus_specific): Delete.
+ (symbol_set_demangled_name): Remove special c++ support.
+ (symbol_get_demangled_name, symbol_set_language): Ditto.
+ * symtab.h (struct cplus_specific): Delete.
+ (struct general_symbol_info) <language_specific>: Remove
+ cplus_specific.
+
+2014-12-02 Doug Evans <dje@google.com>
+
PR symtab/17602
* linespec.c (iterate_name_matcher): Fix arguments to symbol_name_cmp.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 345c20d..a52f7c0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -473,40 +473,15 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
return (mangled_name);
}
-/* Initialize the cplus_specific structure. 'cplus_specific' should
- only be allocated for use with cplus symbols. */
-
-static void
-symbol_init_cplus_specific (struct general_symbol_info *gsymbol,
- struct obstack *obstack)
-{
- /* A language_specific structure should not have been previously
- initialized. */
- gdb_assert (gsymbol->language_specific.cplus_specific == NULL);
- gdb_assert (obstack != NULL);
-
- gsymbol->language_specific.cplus_specific =
- OBSTACK_ZALLOC (obstack, struct cplus_specific);
-}
-
/* Set the demangled name of GSYMBOL to NAME. NAME must be already
- correctly allocated. For C++ symbols a cplus_specific struct is
- allocated so OBJFILE must not be NULL. If this is a non C++ symbol
- OBJFILE can be NULL. */
+ correctly allocated. */
void
symbol_set_demangled_name (struct general_symbol_info *gsymbol,
const char *name,
struct obstack *obstack)
{
- if (gsymbol->language == language_cplus)
- {
- if (gsymbol->language_specific.cplus_specific == NULL)
- symbol_init_cplus_specific (gsymbol, obstack);
-
- gsymbol->language_specific.cplus_specific->demangled_name = name;
- }
- else if (gsymbol->language == language_ada)
+ if (gsymbol->language == language_ada)
{
if (name == NULL)
{
@@ -528,14 +503,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol,
const char *
symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
{
- if (gsymbol->language == language_cplus)
- {
- if (gsymbol->language_specific.cplus_specific != NULL)
- return gsymbol->language_specific.cplus_specific->demangled_name;
- else
- return NULL;
- }
- else if (gsymbol->language == language_ada)
+ if (gsymbol->language == language_ada)
{
if (!gsymbol->ada_mangled)
return NULL;
@@ -555,7 +523,8 @@ symbol_set_language (struct general_symbol_info *gsymbol,
struct obstack *obstack)
{
gsymbol->language = language;
- if (gsymbol->language == language_d
+ if (gsymbol->language == language_cplus
+ || gsymbol->language == language_d
|| gsymbol->language == language_go
|| gsymbol->language == language_java
|| gsymbol->language == language_objc
@@ -568,8 +537,6 @@ symbol_set_language (struct general_symbol_info *gsymbol,
gdb_assert (gsymbol->ada_mangled == 0);
gsymbol->language_specific.obstack = obstack;
}
- else if (gsymbol->language == language_cplus)
- gsymbol->language_specific.cplus_specific = NULL;
else
{
memset (&gsymbol->language_specific, 0,
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 473c85c..57d234d 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -80,13 +80,6 @@ struct common_block;
--chastain 2003-08-21 */
-/* Struct for storing C++ specific information. Allocated when needed. */
-
-struct cplus_specific
-{
- const char *demangled_name;
-};
-
/* Define a structure for the information that is common to all symbol types,
including minimal symbols, partial symbols, and full symbols. In a
multilanguage environment, some language specific information may need to
@@ -141,14 +134,12 @@ struct general_symbol_info
struct obstack *obstack;
/* This is used by languages which wish to store a demangled name.
- currently used by Ada, Java, and Objective C. */
+ currently used by Ada, C++, Java, and Objective C. */
struct mangled_lang
{
const char *demangled_name;
}
mangled_lang;
-
- struct cplus_specific *cplus_specific;
}
language_specific;