GNU Binutils with patches for OS216
Révision | bb749d8ae30108c85d3ae5011a4261d01574b342 (tree) |
---|---|
l'heure | 2019-11-11 02:44:49 |
Auteur | Tom Tromey <tom@trom...> |
Commiter | Tom Tromey |
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-10-19 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
@@ -1,3 +1,10 @@ | ||
1 | +2019-10-19 Tom Tromey <tom@tromey.com> | |
2 | + | |
3 | + * symtab.h (struct minimal_symbol) <name_set>: New member. | |
4 | + * minsyms.c (minimal_symbol_reader::record_full): Copy name. | |
5 | + Don't call symbol_set_names. | |
6 | + (minimal_symbol_reader::install): Call symbol_set_names. | |
7 | + | |
1 | 8 | 2019-11-10 Tom Tromey <tom@tromey.com> |
2 | 9 | |
3 | 10 | * tui/tui-wingeneral.c (tui_unhighlight_win): Use can_box. |
@@ -1127,7 +1127,12 @@ minimal_symbol_reader::record_full (gdb::string_view name, | ||
1127 | 1127 | msymbol = &m_msym_bunch->contents[m_msym_bunch_index]; |
1128 | 1128 | symbol_set_language (msymbol, language_auto, |
1129 | 1129 | &m_objfile->per_bfd->storage_obstack); |
1130 | - symbol_set_names (msymbol, name, copy_name, m_objfile->per_bfd); | |
1130 | + | |
1131 | + if (copy_name) | |
1132 | + msymbol->name = obstack_strndup (&m_objfile->per_bfd->storage_obstack, | |
1133 | + name.data (), name.size ()); | |
1134 | + else | |
1135 | + msymbol->name = name.data (); | |
1131 | 1136 | |
1132 | 1137 | SET_MSYMBOL_VALUE_ADDRESS (msymbol, address); |
1133 | 1138 | MSYMBOL_SECTION (msymbol) = section; |
@@ -1354,6 +1359,17 @@ minimal_symbol_reader::install () | ||
1354 | 1359 | m_objfile->per_bfd->minimal_symbol_count = mcount; |
1355 | 1360 | m_objfile->per_bfd->msymbols = std::move (msym_holder); |
1356 | 1361 | |
1362 | + msymbols = m_objfile->per_bfd->msymbols.get (); | |
1363 | + for (int i = 0; i < mcount; ++i) | |
1364 | + { | |
1365 | + if (!msymbols[i].name_set) | |
1366 | + { | |
1367 | + symbol_set_names (&msymbols[i], msymbols[i].name, | |
1368 | + false, m_objfile->per_bfd); | |
1369 | + msymbols[i].name_set = 1; | |
1370 | + } | |
1371 | + } | |
1372 | + | |
1357 | 1373 | build_minimal_symbol_hash_tables (m_objfile); |
1358 | 1374 | } |
1359 | 1375 | } |
@@ -698,6 +698,10 @@ struct minimal_symbol : public general_symbol_info | ||
698 | 698 | |
699 | 699 | unsigned maybe_copied : 1; |
700 | 700 | |
701 | + /* Non-zero if this symbol ever had its demangled name set (even if | |
702 | + it was set to NULL). */ | |
703 | + unsigned int name_set : 1; | |
704 | + | |
701 | 705 | /* Minimal symbols with the same hash key are kept on a linked |
702 | 706 | list. This is the link. */ |
703 | 707 |