llvm-project
860d5d40 - [lldb][NFC] Move two scans of symbol table to Symtab methods (#241113)

Commit
6 days ago
[lldb][NFC] Move two scans of symbol table to Symtab methods (#241113) This patchset changes two areas that were iterating over all Symbols inside a Symtab, to instead call a method on Symtab. `SymbolFileDWARFDebugMap::InitOSO` looks at every symbol to detect any Mach-O debug map entries that are pointing to .o files with the dwarf in them. It will now call `Symtab::HasDebugMap()`. `SymbolFileSymtab::CalculateAbilities` searches for every symbol of type eSymbolTypeSourceFile to add CompileUnits on to the capabilities flags returned; that's now done by `Symtab::HasSourceFiles`. It also initialized some lookups in SymbolFileSymtab eagerly: `m_func_indexes`, `m_code_indexes`, `m_data_indexes`, `m_source_indexes`, and `m_objc_class_name_to_index`. Three of those indexes are not used: `m_func_indexes`, `m_data_indexes`, `m_objc_class_name_to_index`. Move the calculation of `m_source_indexes` and `m_code_indexes` into a new `SymbolFileSymtab::InitializeSymbolIndexes` method. In Symtab, add optional bools `m_has_debug_map` and `m_has_source_files` which are calculated lazily via accessor methods, and their values are reset if Symbols are added or the Symbol array is resized in the Symtab. This is groundwork for adding a bloom filter on the Symtab which will be the only thing we load initially, until a name match happens or a query that forces all symbols to be present is received. This PR is fixing two of those "all symbols must be present" cases. In the bloom filter I'll save the number of symbols, `has_debug_map`, and `has_source_files` in the header. I may also add `has_debug_map` and `has_source_files` to the DataFileCache symtab, to eliminate the need for those to be calculated when we've read a serialized symbol table. This PR leads to no change in behavior with current lldb; it simply centralizes these two full-scan-of-symbol-tables into Symtab for future optimization. Assisted-By: Claude rdar://188332881
Author
Parents
Loading