================
@@ -1130,16 +1130,47 @@ void SymbolFileNativePDB::AddSymbols(Symtab &symtab) {
if (!section_list)
return;
- for (auto pid : m_index->publics().getPublicsTable()) {
+ PublicSym32 last_sym;
+ size_t last_sym_idx = 0;
+ lldb::SectionSP section_sp;
+
+ // To estimate the size of a symbol, we use the difference to the next
symbol.
+ // If there's no next symbol or the section/segment changed, the symbol will
+ // take the remaining space. The estimate can be too high in case there's
+ // padding between symbols. This similar to the algorithm used by the DIA
+ // SDK.
+ auto finish_last_symbol = [&](const PublicSym32 *next) {
+ if (!section_sp)
+ return;
+ Symbol *last = symtab.SymbolAtIndex(last_sym_idx);
----------------
bulbazord wrote:
I'm trying to understand how this `AddSymbols` implementation works. I'm also
not an expert on windows or PDBs, so please bear with me.
This gets called by `SymbolFileCommon::GetSymtab` which gets (or creates) the
existing symtab from the main object file. Whatever ObjectFile created the
symtab also parsed the symbol table and populated the Symtab, right? So why
does this function start with `last_sym_idx` set to 0? Might
`finish_last_symbol` then clobber the byte sizes of existing symbols?
https://github.com/llvm/llvm-project/pull/165727
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits