@@ -92,8 +92,7 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
92
92
}
93
93
94
94
/* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE.
95
- At the end, copy them all into one newly allocated location on an objfile's
96
- per-BFD storage obstack. */
95
+ At the end, copy them all into one newly allocated array. */
97
96
98
97
#define BUNCH_SIZE 127
99
98
@@ -1031,11 +1030,7 @@ minimal_symbol_reader::minimal_symbol_reader (struct objfile *obj)
1031
1030
1032
1031
/* Discard the currently collected minimal symbols, if any. If we wish
1033
1032
to save them for later use, we must have already copied them somewhere
1034
- else before calling this function.
1035
-
1036
- FIXME: We could allocate the minimal symbol bunches on their own
1037
- obstack and then simply blow the obstack away when we are done with
1038
- it. Is it worth the extra trouble though? */
1033
+ else before calling this function. */
1039
1034
1040
1035
minimal_symbol_reader ::~minimal_symbol_reader ()
1041
1036
{
@@ -1231,15 +1226,6 @@ compare_minimal_symbols (const void *fn1p, const void *fn2p)
1231
1226
to linearly scan the table, which is done in a number of places. So we
1232
1227
just do one linear scan here and toss out the duplicates.
1233
1228
1234
- Note that we are not concerned here about recovering the space that
1235
- is potentially freed up, because the strings themselves are allocated
1236
- on the storage_obstack, and will get automatically freed when the symbol
1237
- table is freed. The caller can free up the unused minimal symbols at
1238
- the end of the compacted region if their allocation strategy allows it.
1239
-
1240
- Also note we only go up to the next to last entry within the loop
1241
- and then copy the last entry explicitly after the loop terminates.
1242
-
1243
1229
Since the different sources of information for each symbol may
1244
1230
have different levels of "completeness", we may have duplicates
1245
1231
that have one entry with type "mst_unknown" and the other with a
@@ -1315,24 +1301,7 @@ build_minimal_symbol_hash_tables (struct objfile *objfile)
1315
1301
minimal symbol table. In most cases there is no minimal symbol table yet
1316
1302
for this objfile, and the existing bunches are used to create one. Once
1317
1303
in a while (for shared libraries for example), we add symbols (e.g. common
1318
- symbols) to an existing objfile.
1319
-
1320
- Because of the way minimal symbols are collected, we generally have no way
1321
- of knowing what source language applies to any particular minimal symbol.
1322
- Specifically, we have no way of knowing if the minimal symbol comes from a
1323
- C++ compilation unit or not. So for the sake of supporting cached
1324
- demangled C++ names, we have no choice but to try and demangle each new one
1325
- that comes in. If the demangling succeeds, then we assume it is a C++
1326
- symbol and set the symbol's language and demangled name fields
1327
- appropriately. Note that in order to avoid unnecessary demanglings, and
1328
- allocating obstack space that subsequently can't be freed for the demangled
1329
- names, we mark all newly added symbols with language_auto. After
1330
- compaction of the minimal symbols, we go back and scan the entire minimal
1331
- symbol table looking for these new symbols. For each new symbol we attempt
1332
- to demangle it, and if successful, record it as a language_cplus symbol
1333
- and cache the demangled form on the symbol obstack. Symbols which don't
1334
- demangle are marked as language_unknown symbols, which inhibits future
1335
- attempts to demangle them if we later add more minimal symbols. */
1304
+ symbols) to an existing objfile. */
1336
1305
1337
1306
void
1338
1307
minimal_symbol_reader ::install ()
@@ -1354,10 +1323,10 @@ minimal_symbol_reader::install ()
1354
1323
m_msym_count , objfile_name (m_objfile ));
1355
1324
}
1356
1325
1357
- /* Allocate enough space in the obstack , into which we will gather the
1358
- bunches of new and existing minimal symbols, sort them, and then
1359
- compact out the duplicate entries. Once we have a final table,
1360
- we will give back the excess space. */
1326
+ /* Allocate enough space, into which we will gather the bunches
1327
+ of new and existing minimal symbols, sort them, and then
1328
+ compact out the duplicate entries. Once we have a final
1329
+ table, we will give back the excess space. */
1361
1330
1362
1331
alloc_count = m_msym_count + m_objfile -> per_bfd -> minimal_symbol_count ;
1363
1332
gdb ::unique_xmalloc_ptr < minimal_symbol >
@@ -1407,10 +1376,6 @@ minimal_symbol_reader::install ()
1407
1376
m_objfile -> per_bfd -> minimal_symbol_count = mcount ;
1408
1377
m_objfile -> per_bfd -> msymbols = std ::move (msym_holder );
1409
1378
1410
- /* Now build the hash tables; we can't do this incrementally
1411
- at an earlier point since we weren't finished with the obstack
1412
- yet. (And if the msymbol obstack gets moved, all the internal
1413
- pointers to other msymbols need to be adjusted.) */
1414
1379
build_minimal_symbol_hash_tables (m_objfile );
1415
1380
}
1416
1381
}
0 commit comments