mstorsjo added a comment. When testing this patch, I ran into crashes in the `SymbolFile/NativePDB/load-pdb.cpp` testcase. To fix it, I had to add a change like this:
diff --git a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp index 26df0035b37c..e08753b86d5b 100644 --- a/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp +++ b/lldb/source/Plugins/SymbolVendor/PECOFF/SymbolVendorPECOFF.cpp @@ -108,6 +108,8 @@ SymbolVendorPECOFF::CreateInstance(const lldb::ModuleSP &module_sp, // that. SectionList *module_section_list = module_sp->GetSectionList(); SectionList *objfile_section_list = dsym_objfile_sp->GetSectionList(); + if (!objfile_section_list || !module_section_list) + return nullptr; static const SectionType g_sections[] = { eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAranges, Also, when built with assertions enabled (which often is to prefer during development, to catch things before the buildbots do), reading the debuglink info failed an assert: lldb/source/Utility/DataExtractor.cpp:135: lldb_private::DataExtractor::DataExtractor(const void*, lldb::offset_t, lldb::ByteOrder, uint32_t, uint32_t): Assertion `addr_size >= 1 && addr_size <= 8' failed. This is easy to fix with a change like this: diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index ba4612178be7..657fcdc5af6d 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -63,7 +63,7 @@ static bool GetDebugLinkContents(const llvm::object::COFFObjectFile &coff_obj, } DataExtractor data( content->data(), content->size(), - coff_obj.isLittleEndian() ? eByteOrderLittle : eByteOrderBig, 0); + coff_obj.isLittleEndian() ? eByteOrderLittle : eByteOrderBig, 4); lldb::offset_t gnu_debuglink_offset = 0; gnu_debuglink_file = data.GetCStr(&gnu_debuglink_offset); // Align to the next 4-byte offset If it's ok with you, I can squash these changes (plus a rewording regarding GNU ld and the codeview build ID) and push the patch. ================ Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:96 + + // The GNU linker does not write a PDB build id, so we should fall back to + // using the crc from .gnu_debuglink if it exists, just like how ObjectFileELF ---------------- Actually, the GNU linker does write such a build id if you pass it `-Wl,--build-id`, but it's not default like in LLD. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126367/new/ https://reviews.llvm.org/D126367 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits