[Lldb-commits] [lldb] [llvm] [lldb][NativePDB] Fix crash in debugger when PDB has bad type index value (PR #166455)
Vladimir Gorsunov via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 18 02:11:02 PST 2025
gv wrote:
> Opened #166566 for this.
As #166566 is merged I tried to load a PDB generated by `llvm-pdbutil` into lldb. I took the file `inline_sites.test.tmp.pdb` produced by `lld-link` from `inline_sites.test` and put it through `llvm-pdbutil
pdb2yaml --all | llvm-pdbutil yaml2pdb`. The resulting file can be loaded into the debugger all right (which wasn't the case before) but it can't resolve any address, because it doesn't have any section contributions (that can be confirmed with `llvm-pdbutil dump --section-contribs`).
AFAICS there is no support for converting section contributions to or from YAML. Until that is changed, `llvm-pdbutil` can't be used for creating a PDB file that will trigger the crash because the crash is in the address resolution path. I. e.
Thread 1 "lldb" received signal SIGSEGV, Segmentation fault.
0x00007dd8c9160ca1 in llvm::codeview::LazyRandomTypeCollection::getType (this=0x63574517b850, Index=...) at /home/vg/25-llvm/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp:93
93 return Records[Index.toArrayIndex()].Type;
(gdb) bt
#0 0x00007dd8c9160ca1 in llvm::codeview::LazyRandomTypeCollection::getType (this=0x63574517b850, Index=...)
at /home/vg/25-llvm/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp:93
#1 0x00007dd8c7821ac3 in lldb_private::npdb::SymbolFileNativePDB::ParseInlineSite (this=0x6357450af750,
id=..., func_addr=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1624
#2 0x00007dd8c7821ebd in operator() (id=..., kind=<optimized out>, __closure=0x7ffe98c2fac0)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1350
#3 llvm::function_ref<bool(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)>::callback_fn<lldb_private::npdb::SymbolFileNativePDB::ParseLineTable(lldb_private::CompileUnit&)::<lambda(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)> >(intptr_t, llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId) (callable=callable at entry=140731461335744, params#0=<optimized out>, params#1=...,
params#1 at entry=...) at /home/vg/25-llvm/release/include/llvm/ADT/STLFunctionalExtras.h:46
#4 0x00007dd8c7818259 in llvm::function_ref<bool (llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)>::operator()(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId) const (params#1=...,
params#0=<optimized out>, this=<synthetic pointer>)
at /home/vg/25-llvm/release/include/llvm/ADT/STLFunctionalExtras.h:68
#5 lldb_private::npdb::SymbolFileNativePDB::ParseSymbolArrayInScope(lldb_private::npdb::PdbCompilandSymId, llvm::function_ref<bool (llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)>) (
this=<optimized out>, parent_id=..., fn=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1687
#6 0x00007dd8c7820580 in lldb_private::npdb::SymbolFileNativePDB::ParseLineTable (this=0x6357450af750,
comp_unit=...) at /home/vg/25-llvm/release/include/llvm/ADT/STLFunctionalExtras.h:55
#7 0x00007dd8c700c494 in lldb_private::CompileUnit::GetLineTable (this=0x635744e8daf0)
at /home/vg/25-llvm/lldb/source/Symbol/CompileUnit.cpp:171
#8 0x00007dd8c781a05a in lldb_private::npdb::SymbolFileNativePDB::CreateBlock (this=0x6357450af750,
block_id=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:444
#9 0x00007dd8c781a2c3 in lldb_private::npdb::SymbolFileNativePDB::GetOrCreateBlock (this=0x6357450af750,
block_id=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1024
#10 0x00007dd8c781a323 in operator() (id=..., kind=llvm::codeview::S_INLINESITE, __closure=0x7ffe98c30228)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1661
#11 llvm::function_ref<bool(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)>::callback_fn<lldb_private::npdb::SymbolFileNativePDB::ParseBlocksRecursive(lldb_private::Function&)::<lambda(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)> >(intptr_t, llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId) (callable=callable at entry=140731461337640, params#0=<optimized out>, params#1=...,
params#1 at entry=...) at /home/vg/25-llvm/release/include/llvm/ADT/STLFunctionalExtras.h:46
#12 0x00007dd8c7818259 in llvm::function_ref<bool (llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilan--Type <RET> for more, q to quit, c to continue without paging--
dSymId)>::operator()(llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId) const (params#1=...,
params#0=<optimized out>, this=<synthetic pointer>)
at /home/vg/25-llvm/release/include/llvm/ADT/STLFunctionalExtras.h:68
#13 lldb_private::npdb::SymbolFileNativePDB::ParseSymbolArrayInScope(lldb_private::npdb::PdbCompilandSymId, llvm::function_ref<bool (llvm::codeview::SymbolKind, lldb_private::npdb::PdbCompilandSymId)>) (
this=<optimized out>, parent_id=..., fn=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1687
#14 0x00007dd8c7818349 in lldb_private::npdb::SymbolFileNativePDB::ParseBlocksRecursive (
this=0x6357450af750, func=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1668
#15 0x00007dd8c7015c71 in lldb_private::Function::GetBlock (this=0x635744f3f440,
can_create=can_create at entry=true) at /home/vg/25-llvm/lldb/source/Symbol/Function.cpp:386
#16 0x00007dd8c781a534 in lldb_private::npdb::SymbolFileNativePDB::ResolveSymbolContext (
this=0x6357450af750, addr=..., resolve_scope=72, sc=...)
at /home/vg/25-llvm/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:1174
#17 0x00007dd8c6f62f66 in lldb_private::Module::ResolveSymbolContextForAddress (this=0x635745141860,
so_addr=..., resolve_scope=resolve_scope at entry=72, sc=...,
resolve_tail_call_address=resolve_tail_call_address at entry=false)
at /home/vg/25-llvm/lldb/source/Core/Module.cpp:487
#18 0x00007dd8c6f39470 in lldb_private::Address::CalculateSymbolContext (this=0x6357461011a0,
sc=0x635745fcb840, resolve_scope=72) at /home/vg/25-llvm/lldb/source/Core/Address.cpp:832
#19 0x00007dd8c6f394c7 in lldb_private::Address::ResolveFunctionScope (this=this at entry=0x6357461011a0,
sym_ctx=...) at /home/vg/25-llvm/lldb/source/Core/Address.cpp:270
#20 0x00007dd8c70dd805 in lldb_private::RegisterContextUnwind::InitializeZerothFrame (this=0x635746101110)
at /home/vg/25-llvm/lldb/source/Target/RegisterContextUnwind.cpp:163
#21 0x00007dd8c70ddfc9 in lldb_private::RegisterContextUnwind::RegisterContextUnwind (
this=this at entry=0x635746101110, thread=...,
next_frame=std::shared_ptr<lldb_private::RegisterContextUnwind> (empty) = {...}, sym_ctx=...,
frame_number=frame_number at entry=0, unwind_lldb=...)
at /home/vg/25-llvm/lldb/source/Target/RegisterContextUnwind.cpp:73
#22 0x00007dd8c70cd220 in lldb_private::UnwindLLDB::AddFirstFrame (this=0x7dd7a0050470)
at /home/vg/25-llvm/lldb/source/Target/UnwindLLDB.cpp:81
#23 lldb_private::UnwindLLDB::AddFirstFrame (this=0x7dd7a0050470)
at /home/vg/25-llvm/lldb/source/Target/UnwindLLDB.cpp:71
#24 0x00007dd8c70cd519 in lldb_private::UnwindLLDB::DoGetFrameInfoAtIndex (this=0x7dd7a0050470, idx=0,
cfa=@0x7ffe98c309f0: 18446744073709551615, pc=@0x7ffe98c309e8: 18446744073709551615,
behaves_like_zeroth_frame=@0x7ffe98c309e7: true)
at /home/vg/25-llvm/lldb/source/Target/UnwindLLDB.cpp:400
https://github.com/llvm/llvm-project/pull/166455
More information about the lldb-commits
mailing list