aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-02 13:19:44 -0700
committerTom Tromey <tom@tromey.com>2019-11-26 14:02:57 -0700
commit5a79c10755d00b71b33b8715e5a665bfd78c9222 (patch)
treec87caab20f43574be702e9acbb017f19e6f44d65
parentaa36950904393728b2d5e75fb5bca7a25418c00f (diff)
downloadgdb-5a79c10755d00b71b33b8715e5a665bfd78c9222.zip
gdb-5a79c10755d00b71b33b8715e5a665bfd78c9222.tar.gz
gdb-5a79c10755d00b71b33b8715e5a665bfd78c9222.tar.bz2
Defer minimal symbol name-setting
Currently the demangled name of a minimal symbol is set when creating the symbol. However, there is no intrinsic need to do this. This patch instead arranges for the demangling to be done just before the minsym hash tables are filled. This will be useful in a later patch. gdb/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * symtab.h (struct minimal_symbol) <name_set>: New member. * minsyms.c (minimal_symbol_reader::record_full): Copy name. Don't call symbol_set_names. (minimal_symbol_reader::install): Call symbol_set_names. Change-Id: I4fe3993b99fb3a43968067806e294d48e377fd76
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/minsyms.c18
-rw-r--r--gdb/symtab.h4
3 files changed, 28 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b061e88..dc684be 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-26 Tom Tromey <tom@tromey.com>
+
+ * symtab.h (struct minimal_symbol) <name_set>: New member.
+ * minsyms.c (minimal_symbol_reader::record_full): Copy name.
+ Don't call symbol_set_names.
+ (minimal_symbol_reader::install): Call symbol_set_names.
+
2019-11-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* python/python.c (gdbpy_enter::~gdbpy_enter): Release GIL after
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index a9ba66b..6e7021a 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1127,7 +1127,12 @@ minimal_symbol_reader::record_full (gdb::string_view name,
msymbol = &m_msym_bunch->contents[m_msym_bunch_index];
symbol_set_language (msymbol, language_auto,
&m_objfile->per_bfd->storage_obstack);
- symbol_set_names (msymbol, name, copy_name, m_objfile->per_bfd);
+
+ if (copy_name)
+ msymbol->name = obstack_strndup (&m_objfile->per_bfd->storage_obstack,
+ name.data (), name.size ());
+ else
+ msymbol->name = name.data ();
SET_MSYMBOL_VALUE_ADDRESS (msymbol, address);
MSYMBOL_SECTION (msymbol) = section;
@@ -1354,6 +1359,17 @@ minimal_symbol_reader::install ()
m_objfile->per_bfd->minimal_symbol_count = mcount;
m_objfile->per_bfd->msymbols = std::move (msym_holder);
+ msymbols = m_objfile->per_bfd->msymbols.get ();
+ for (int i = 0; i < mcount; ++i)
+ {
+ if (!msymbols[i].name_set)
+ {
+ symbol_set_names (&msymbols[i], msymbols[i].name,
+ false, m_objfile->per_bfd);
+ msymbols[i].name_set = 1;
+ }
+ }
+
build_minimal_symbol_hash_tables (m_objfile);
}
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 897ffda..bcbc9c8 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -668,6 +668,10 @@ struct minimal_symbol : public general_symbol_info
unsigned maybe_copied : 1;
+ /* Non-zero if this symbol ever had its demangled name set (even if
+ it was set to NULL). */
+ unsigned int name_set : 1;
+
/* Minimal symbols with the same hash key are kept on a linked
list. This is the link. */