[Lldb-commits] [lldb] [lldb][NativePDB] Accept functions without a type (PR #236547)

via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 31 13:52:37 PDT 2026


https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/236547

>From 3a50e45fe8dee025727f75d7a56c48e70a445e7b Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Wed, 28 Oct 2026 20:33:36 +0100
Subject: [PATCH 1/5] [lldb][NativePDB] Accept functions without a type

---
 .../NativePDB/SymbolFileNativePDB.cpp         |  40 +-
 .../Inputs/line-tables-only-pdb.yaml          | 394 ++++++++++++++++++
 .../NativePDB/line-tables-only-decl.test      |  18 +
 .../NativePDB/line-tables-only-run.yaml       | 116 ++++++
 4 files changed, 552 insertions(+), 16 deletions(-)
 create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
 create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
 create mode 100644 lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index bab14c752638c7..c4352a45b840c2 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -598,32 +598,34 @@ lldb::FunctionSP SymbolFileNativePDB::CreateFunction(PdbCompilandSymId func_id,
                    "Failed to deserialize ProcSym record: {0}");
     return nullptr;
   }
-  if (proc.FunctionType == TypeIndex::None())
-    return nullptr;
-  TypeSP func_type = GetOrCreateType(proc.FunctionType);
-  if (!func_type)
-    return nullptr;
 
-  PdbTypeSymId sig_id(proc.FunctionType, false);
+  TypeSP func_type;
+  uint64_t func_type_uid = LLDB_INVALID_UID;
+  if (!proc.FunctionType.isNoneType()) {
+    func_type = GetOrCreateType(proc.FunctionType);
+    PdbTypeSymId sig_id(proc.FunctionType, false);
+    func_type_uid = toOpaqueUid(sig_id);
+  }
 
   std::optional<llvm::StringRef> mangled_opt = FindMangledSymbol(
       SegmentOffset(proc.Segment, proc.CodeOffset), proc.FunctionType);
   Mangled mangled(mangled_opt.value_or(proc.Name));
 
   FunctionSP func_sp = std::make_shared<Function>(
-      &comp_unit, toOpaqueUid(func_id), toOpaqueUid(sig_id), mangled,
-      func_type.get(), func_addr,
-      AddressRanges{AddressRange(func_addr, sol.length)});
+      &comp_unit, toOpaqueUid(func_id), func_type_uid, mangled, func_type.get(),
+      func_addr, AddressRanges{AddressRange(func_addr, sol.length)});
 
   comp_unit.AddFunction(func_sp);
 
-  auto ts_or_err = GetTypeSystemForLanguage(comp_unit.GetLanguage());
-  if (auto err = ts_or_err.takeError())
-    return func_sp;
-  auto ts = *ts_or_err;
-  if (ts) {
-    if (PdbAstBuilder *ast_builder = ts->GetNativePDBParser())
-      ast_builder->EnsureFunction(func_id);
+  if (!proc.FunctionType.isNoneType()) {
+    auto ts_or_err = GetTypeSystemForLanguage(comp_unit.GetLanguage());
+    if (auto err = ts_or_err.takeError())
+      return func_sp;
+    auto ts = *ts_or_err;
+    if (ts) {
+      if (PdbAstBuilder *ast_builder = ts->GetNativePDBParser())
+        ast_builder->EnsureFunction(func_id);
+    }
   }
 
   return func_sp;
@@ -2792,6 +2794,9 @@ size_t SymbolFileNativePDB::ParseVariablesForBlock(PdbCompilandSymId block_id) {
                      "Failed to deserialize ProcSym record: {0}");
       return 0;
     }
+    if (proc.FunctionType.isNoneType())
+      return 0;
+
     CVType signature = m_index->tpi().getType(proc.FunctionType);
     if (signature.kind() == LF_PROCEDURE) {
       ProcedureRecord sig;
@@ -2964,6 +2969,9 @@ SymbolFileNativePDB::GetDeclContextContainingUID(lldb::user_id_t uid) {
 }
 
 Type *SymbolFileNativePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
+  if (type_uid == LLDB_INVALID_UID)
+    return nullptr;
+
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
   auto iter = m_types.find(type_uid);
   // lldb should not be passing us non-sensical type uids.  the only way it
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
new file mode 100644
index 00000000000000..0ffecb4ee3162c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
@@ -0,0 +1,394 @@
+# Generated from
+
+# $ clang-cl /Z7 -fuse-ld=lld line-tables-only.cpp /GS- -gline-tables-only /link /nodefaultlib /entry:main
+# $ cat line-tables-only.cpp
+# static int stopHere() {
+#   int i = 0;
+#   return 123 + i;
+# }
+# 
+# __forceinline int inlineme_too(int x) {
+#   stopHere();
+#   return x + 1;
+# }
+# 
+# static __forceinline int inlineme(int x, int y) {
+#   return inlineme_too(x) + inlineme_too(y);
+# }
+# 
+# static int foo() { return inlineme(1, 2); }
+# 
+# int callme() { return foo(); }
+# 
+# int main() { return callme(); }
+
+---
+DbiStream:
+  VerHeader:       V70
+  Age:             1
+  BuildNumber:     36363
+  PdbDllVersion:   0
+  PdbDllRbld:      0
+  Flags:           0
+  MachineType:     Amd64
+  Modules:
+    - Module:          '/tmp/line-tables-only-abcdef1234567890abcdef12345.obj'
+      ObjFile:         '/tmp/line-tables-only-abcdef1234567890abcdef12345.obj'
+      SourceFiles:
+        - '/tmp/line-tables-only.cpp'
+      Subsections:
+        - !InlineeLines
+          HasExtraFiles:   false
+          Sites:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              LineNum:         11
+              Inlinee:         4096
+            - FileName:        '/tmp/line-tables-only.cpp'
+              LineNum:         6
+              Inlinee:         4097
+        - !Lines
+          CodeSize:        15
+          Flags:           [  ]
+          RelocOffset:     0
+          RelocSegment:    1
+          Blocks:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              Lines:
+                - Offset:          0
+                  LineStart:       17
+                  IsStatement:     false
+                  EndDelta:        0
+              Columns:         []
+        - !Lines
+          CodeSize:        75
+          Flags:           [  ]
+          RelocOffset:     16
+          RelocSegment:    1
+          Blocks:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              Lines:
+                - Offset:          0
+                  LineStart:       15
+                  IsStatement:     false
+                  EndDelta:        0
+                - Offset:          70
+                  LineStart:       15
+                  IsStatement:     false
+                  EndDelta:        0
+              Columns:         []
+        - !Lines
+          CodeSize:        23
+          Flags:           [  ]
+          RelocOffset:     96
+          RelocSegment:    1
+          Blocks:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              Lines:
+                - Offset:          0
+                  LineStart:       19
+                  IsStatement:     false
+                  EndDelta:        0
+              Columns:         []
+        - !Lines
+          CodeSize:        18
+          Flags:           [  ]
+          RelocOffset:     128
+          RelocSegment:    1
+          Blocks:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              Lines:
+                - Offset:          0
+                  LineStart:       1
+                  IsStatement:     false
+                  EndDelta:        0
+                - Offset:          1
+                  LineStart:       2
+                  IsStatement:     false
+                  EndDelta:        0
+                - Offset:          9
+                  LineStart:       3
+                  IsStatement:     false
+                  EndDelta:        0
+              Columns:         []
+        - !FileChecksums
+          Checksums:
+            - FileName:        '/tmp/line-tables-only.cpp'
+              Kind:            MD5
+              Checksum:        DA90A4DC4D87B7A01995315F2BE7BDC7
+      Modi:
+        Signature:       4
+        Records:
+          - Kind:            S_OBJNAME
+            ObjNameSym:
+              Signature:       0
+              ObjectName:      '/tmp/line-tables-only-abcdef1234567890abcdef12345.obj'
+          - Kind:            S_COMPILE3
+            Compile3Sym:
+              Flags:           [  ]
+              Language:        Cpp
+              Machine:         X64
+              FrontendMajor:   24
+              FrontendMinor:   0
+              FrontendBuild:   0
+              FrontendQFE:     0
+              BackendMajor:    24000
+              BackendMinor:    0
+              BackendBuild:    0
+              BackendQFE:      0
+              Version:         'clang version 00.0.0git (------------------------------------------------------------------------------------)'
+          - Kind:            S_GPROC32
+            ProcSym:
+              PtrParent:       0
+              PtrEnd:          288
+              PtrNext:         0
+              CodeSize:        15
+              DbgStart:        0
+              DbgEnd:          0
+              FunctionType:    0
+              Offset:          0
+              Segment:         1
+              Flags:           [ IsNoInline, HasOptimizedDebugInfo ]
+              DisplayName:     callme
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 40
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [ SafeBuffers ]
+              LocalFramePtrReg: StackPtr
+              ParamFramePtrReg: StackPtr
+          - Kind:            S_END
+            ScopeEndSym:     {}
+          - Kind:            S_LPROC32
+            ProcSym:
+              PtrParent:       0
+              PtrEnd:          464
+              PtrNext:         0
+              CodeSize:        75
+              DbgStart:        0
+              DbgEnd:          0
+              FunctionType:    0
+              Offset:          16
+              Segment:         1
+              Flags:           [ IsNoInline, HasOptimizedDebugInfo ]
+              DisplayName:     foo
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 56
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [ SafeBuffers ]
+              LocalFramePtrReg: StackPtr
+              ParamFramePtrReg: StackPtr
+          - Kind:            S_INLINEES
+            CallerSym:
+              FuncID:          [ 4096 ]
+          - Kind:            S_INLINESITE
+            InlineSiteSym:
+              PtrParent:       292
+              PtrEnd:          460
+              Inlinee:         4096
+              AnnotationData:  [ 6, 2, 3, 20, 4, 50, 0, 0 ]
+          - Kind:            S_INLINESITE
+            InlineSiteSym:
+              PtrParent:       380
+              PtrEnd:          428
+              Inlinee:         4097
+              AnnotationData:  [ 6, 2, 3, 28, 11, 37, 4, 11 ]
+          - Kind:            S_INLINESITE_END
+            ScopeEndSym:     {}
+          - Kind:            S_INLINESITE
+            InlineSiteSym:
+              PtrParent:       380
+              PtrEnd:          456
+              Inlinee:         4097
+              AnnotationData:  [ 6, 2, 3, 52, 11, 41, 4, 7 ]
+          - Kind:            S_INLINESITE_END
+            ScopeEndSym:     {}
+          - Kind:            S_INLINESITE_END
+            ScopeEndSym:     {}
+          - Kind:            S_END
+            ScopeEndSym:     {}
+          - Kind:            S_GPROC32
+            ProcSym:
+              PtrParent:       0
+              PtrEnd:          544
+              PtrNext:         0
+              CodeSize:        23
+              DbgStart:        0
+              DbgEnd:          0
+              FunctionType:    0
+              Offset:          96
+              Segment:         1
+              Flags:           [ IsNoInline, HasOptimizedDebugInfo ]
+              DisplayName:     main
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 40
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [ SafeBuffers ]
+              LocalFramePtrReg: StackPtr
+              ParamFramePtrReg: StackPtr
+          - Kind:            S_END
+            ScopeEndSym:     {}
+          - Kind:            S_LPROC32
+            ProcSym:
+              PtrParent:       0
+              PtrEnd:          628
+              PtrNext:         0
+              CodeSize:        18
+              DbgStart:        0
+              DbgEnd:          0
+              FunctionType:    0
+              Offset:          128
+              Segment:         1
+              Flags:           [ IsNoInline, HasOptimizedDebugInfo ]
+              DisplayName:     stopHere
+          - Kind:            S_FRAMEPROC
+            FrameProcSym:
+              TotalFrameBytes: 8
+              PaddingFrameBytes: 0
+              OffsetToPadding: 0
+              BytesOfCalleeSavedRegisters: 0
+              OffsetOfExceptionHandler: 0
+              SectionIdOfExceptionHandler: 0
+              Flags:           [ SafeBuffers ]
+              LocalFramePtrReg: StackPtr
+              ParamFramePtrReg: StackPtr
+          - Kind:            S_END
+            ScopeEndSym:     {}
+  SectionHeaders:
+    - Name:            .text
+      VirtualSize:     146
+      VirtualAddress:  4096
+      SizeOfRawData:   512
+      PointerToRawData: 1024
+      PointerToRelocations: 0
+      PointerToLinenumbers: 0
+      NumberOfRelocations: 0
+      NumberOfLinenumbers: 0
+      Characteristics: 1610612768
+    - Name:            .rdata
+      VirtualSize:     120
+      VirtualAddress:  8192
+      SizeOfRawData:   512
+      PointerToRawData: 1536
+      PointerToRelocations: 0
+      PointerToLinenumbers: 0
+      NumberOfRelocations: 0
+      NumberOfLinenumbers: 0
+      Characteristics: 1073741888
+    - Name:            .pdata
+      VirtualSize:     48
+      VirtualAddress:  12288
+      SizeOfRawData:   512
+      PointerToRawData: 2048
+      PointerToRelocations: 0
+      PointerToLinenumbers: 0
+      NumberOfRelocations: 0
+      NumberOfLinenumbers: 0
+      Characteristics: 1073741888
+  SectionContribs:
+    Version:         Ver60
+    Items:
+      - ISect:           1
+        Offset:          0
+        Size:            146
+        Characteristics: 1615855648
+        Imod:            0
+        DataCrc:         4019629118
+        RelocCrc:        0
+        ISectCoff:       0
+      - ISect:           2
+        Offset:          0
+        Size:            28
+        Characteristics: 1073741888
+        Imod:            1
+        DataCrc:         0
+        RelocCrc:        0
+        ISectCoff:       0
+      - ISect:           2
+        Offset:          28
+        Size:            58
+        Characteristics: 1073741888
+        Imod:            1
+        DataCrc:         0
+        RelocCrc:        0
+        ISectCoff:       0
+      - ISect:           2
+        Offset:          88
+        Size:            32
+        Characteristics: 1076887616
+        Imod:            0
+        DataCrc:         1716330164
+        RelocCrc:        0
+        ISectCoff:       0
+      - ISect:           3
+        Offset:          0
+        Size:            48
+        Characteristics: 1076887616
+        Imod:            0
+        DataCrc:         2052418443
+        RelocCrc:        0
+        ISectCoff:       0
+TpiStream:
+  Version:         VC80
+  Records:         []
+IpiStream:
+  Version:         VC80
+  Records:
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            inlineme
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            inlineme_too
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            callme
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            foo
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            main
+    - Kind:            LF_FUNC_ID
+      FuncId:
+        ParentScope:     0
+        FunctionType:    0
+        Name:            stopHere
+PublicsStream:
+  Records:
+    - Kind:            S_PUB32
+      PublicSym32:
+        Flags:           [ Function ]
+        Offset:          96
+        Segment:         1
+        Name:            main
+    - Kind:            S_PUB32
+      PublicSym32:
+        Flags:           [ Function ]
+        Offset:          0
+        Segment:         1
+        Name:            '?callme@@YAHXZ'
+...
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
new file mode 100644
index 00000000000000..0a3fe69525224a
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
@@ -0,0 +1,18 @@
+# Check that lldb can generate a backtrace when fed with a PDB without locals or function types.
+
+# RUN: llvm-pdbutil yaml2pdb %p/Inputs/line-tables-only-pdb.yaml --pdb=%t
+# RUN: lldb-test symbols %t | FileCheck %s
+
+# CHECK: Compile units:
+# CHECK-NEXT:   CompileUnit{{.*}}
+# CHECK-NEXT:     Function{{.*}}, mangled = ?callme@@YAHXZ
+# CHECK-NEXT:     Block{{.*}}, ranges = [0x00000fff-0x0000100e)
+# CHECK-NEXT:     Function{{.*}}, demangled = foo
+# CHECK-NEXT:     Block{{.*}}, ranges = [0x0000100f-0x0000105a)
+# CHECK-NEXT:       Block{{.*}}, parent = {0x12400001}, name = "inlineme", decl = line-tables-only.cpp:11, ranges = [0x00001023-0x00001055)
+# CHECK-NEXT:         Block{{.*}}, parent = {0x17c00001}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x0000102b-0x0000103b)
+# CHECK-NEXT:         Block{{.*}}, parent = {0x17c00001}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x00001043-0x00001053)
+# CHECK-NEXT:     Function{{.*}}, demangled = main
+# CHECK-NEXT:     Block{{.*}}, ranges = [0x0000105f-0x00001076)
+# CHECK-NEXT:     Function{{.*}}, demangled = stopHere
+# CHECK-NEXT:     Block{{.*}}, ranges = [0x0000107f-0x00001091)
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml
new file mode 100644
index 00000000000000..88bdaa34733353
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml
@@ -0,0 +1,116 @@
+# REQUIRES: system-windows, target-x86_64
+
+# Check that lldb can generate a backtrace when fed with a PDB without locals or function types.
+
+# RUN: llvm-pdbutil yaml2pdb %p/Inputs/line-tables-only-pdb.yaml --pdb=%t.pdb
+# RUN: yaml2obj %s -o %t.exe
+
+# RUN: %lldb %t.exe -o 'b line-tables-only.cpp:3' -o r -o bt -o q | FileCheck %s
+
+# CHECK:      (lldb) target create
+# CHECK-NEXT: Current executable set to '{{.*}}' (x86_64).
+# CHECK-NEXT: (lldb) b line-tables-only.cpp:3
+# CHECK-NEXT: Breakpoint 1: where = {{.*}}.exe`stopHere + 9 at line-tables-only.cpp:3
+# CHECK-NEXT: (lldb) r
+# CHECK-NEXT: Process {{.*}} launched: '{{.*}}' (x86_64)
+# CHECK-NEXT: Process {{.*}} stopped
+# CHECK-NEXT: * thread #1, stop reason = breakpoint 1.1
+# CHECK-NEXT:        frame #0: {{.*}} {{.*}}.exe`stopHere at line-tables-only.cpp:3
+# CHECK-NEXT: (lldb) bt
+# CHECK-NEXT: * thread #1, stop reason = breakpoint 1.1
+# CHECK-NEXT:    * frame #{{[0-9]+}}: {{.*}}.exe`stopHere at line-tables-only.cpp:3
+# CHECK-NEXT:      frame #{{[0-9]+}}: {{.*}}.exe`inlineme_too at line-tables-only.cpp:7 [inlined]
+# CHECK-NEXT:      frame #{{[0-9]+}}: {{.*}}.exe`inlineme at line-tables-only.cpp:12 [inlined]
+# CHECK-NEXT:      frame #{{[0-9]+}}: {{.*}}.exe`foo at line-tables-only.cpp:15
+# CHECK-NEXT:      frame #{{[0-9]+}}: {{.*}}.exe`int callme(void) at line-tables-only.cpp:17
+# CHECK-NEXT:      frame #{{[0-9]+}}: {{.*}}.exe`main at line-tables-only.cpp:19
+
+--- !COFF
+OptionalHeader:
+  AddressOfEntryPoint: 4192
+  ImageBase:       5368709120
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:       IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  ImportTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  ResourceTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  ExceptionTable:
+    RelativeVirtualAddress: 12288
+    Size:            48
+  CertificateTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  BaseRelocationTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  Debug:
+    RelativeVirtualAddress: 8192
+    Size:            28
+  Architecture:
+    RelativeVirtualAddress: 0
+    Size:            0
+  GlobalPtr:
+    RelativeVirtualAddress: 0
+    Size:            0
+  TlsTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  LoadConfigTable:
+    RelativeVirtualAddress: 0
+    Size:            0
+  BoundImport:
+    RelativeVirtualAddress: 0
+    Size:            0
+  IAT:
+    RelativeVirtualAddress: 0
+    Size:            0
+  DelayImportDescriptor:
+    RelativeVirtualAddress: 0
+    Size:            0
+  ClrRuntimeHeader:
+    RelativeVirtualAddress: 0
+    Size:            0
+header:
+  Machine:         IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:            .text
+    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+    VirtualAddress:  4096
+    VirtualSize:     146
+    SectionData:     4883EC28E807000000904883C428C3904883EC38C744242C02000000C7442428010000008B44242889442434E84F0000008B44243483C001894424248B44242C89442430E8370000008B4424248B4C243083C10101C84883C438C30F1F4400004883EC28C744242400000000E88FFFFFFF904883C428C3660F1F84000000000050C7442404000000008B44240483C07B59C3
+    SizeOfRawData:   512
+  - Name:            .rdata
+    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+    VirtualAddress:  8192
+    VirtualSize:     120
+    SectionData:     000000008141E26A00000000020000003A0000001C2000001C0600005253445389A26FAA121B63474C4C44205044422E01000000463A5C4465765C64756D6D795C6C696E657461626C65735C726570726F2E7064620000000104010004420000010401000462000001040100044200000101010001020000
+    SizeOfRawData:   512
+  - Name:            .pdata
+    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+    VirtualAddress:  12288
+    VirtualSize:     48
+    SectionData:     001000000F10000058200000101000005B10000060200000601000007710000068200000801000009210000070200000
+    SizeOfRawData:   512
+symbols:         []
+...
+
+

>From 0e01ca7af7a5c82fd55d8bbe5320e8cd04b4f417 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Wed, 28 Oct 2026 21:18:06 +0100
Subject: [PATCH 2/5] fix: pdb location

---
 .../NativePDB/Inputs/line-tables-only-pdb.yaml           | 6 ++++++
 .../Shell/SymbolFile/NativePDB/line-tables-only-run.yaml | 9 +++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
index 0ffecb4ee3162c..3de243479b4fac 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
+++ b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/line-tables-only-pdb.yaml
@@ -23,6 +23,12 @@
 # int main() { return callme(); }
 
 ---
+PdbStream:
+  Age:             1
+  Guid:            '{AA6FA289-1B12-4763-4C4C-44205044422E}'
+  Signature:       2859442825
+  Features:        [ VC140 ]
+  Version:         VC70
 DbiStream:
   VerHeader:       V70
   Age:             1
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml
index 88bdaa34733353..42deb38eaf205f 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml
+++ b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-run.yaml
@@ -2,10 +2,11 @@
 
 # Check that lldb can generate a backtrace when fed with a PDB without locals or function types.
 
-# RUN: llvm-pdbutil yaml2pdb %p/Inputs/line-tables-only-pdb.yaml --pdb=%t.pdb
-# RUN: yaml2obj %s -o %t.exe
+# RUN: mkdir -p %t.dir
+# RUN: llvm-pdbutil yaml2pdb %p/Inputs/line-tables-only-pdb.yaml --pdb=%t.dir/line-tables-only.pdb
+# RUN: yaml2obj %s -o %t.dir/line-tables-only.exe
 
-# RUN: %lldb %t.exe -o 'b line-tables-only.cpp:3' -o r -o bt -o q | FileCheck %s
+# RUN: %lldb %t.dir/line-tables-only.exe -o 'b line-tables-only.cpp:3' -o r -o bt -o q | FileCheck %s
 
 # CHECK:      (lldb) target create
 # CHECK-NEXT: Current executable set to '{{.*}}' (x86_64).
@@ -102,7 +103,7 @@ sections:
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
     VirtualAddress:  8192
     VirtualSize:     120
-    SectionData:     000000008141E26A00000000020000003A0000001C2000001C0600005253445389A26FAA121B63474C4C44205044422E01000000463A5C4465765C64756D6D795C6C696E657461626C65735C726570726F2E7064620000000104010004420000010401000462000001040100044200000101010001020000
+    SectionData:     000000008141E26A00000000020000003A0000001C2000001C0600005253445389A26FAA121B63474C4C44205044422E010000002F746D702F6C696E652D7461626C65732D6F6E6C792E70646200000000000000000000000104010004420000010401000462000001040100044200000101010001020000
     SizeOfRawData:   512
   - Name:            .pdata
     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]

>From 8cc1d1c2da6754d5cdb00edaac796e0f2a8f6e3a Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Sat, 31 Oct 2026 21:51:16 +0100
Subject: [PATCH 3/5] fix: early-out

---
 .../NativePDB/SymbolFileNativePDB.cpp          | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index c4352a45b840c2..c7ad77c47edcce 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -616,16 +616,16 @@ lldb::FunctionSP SymbolFileNativePDB::CreateFunction(PdbCompilandSymId func_id,
       func_addr, AddressRanges{AddressRange(func_addr, sol.length)});
 
   comp_unit.AddFunction(func_sp);
+  if (proc.FunctionType.isNoneType())
+    return func_sp;
 
-  if (!proc.FunctionType.isNoneType()) {
-    auto ts_or_err = GetTypeSystemForLanguage(comp_unit.GetLanguage());
-    if (auto err = ts_or_err.takeError())
-      return func_sp;
-    auto ts = *ts_or_err;
-    if (ts) {
-      if (PdbAstBuilder *ast_builder = ts->GetNativePDBParser())
-        ast_builder->EnsureFunction(func_id);
-    }
+  auto ts_or_err = GetTypeSystemForLanguage(comp_unit.GetLanguage());
+  if (auto err = ts_or_err.takeError())
+    return func_sp;
+  auto ts = *ts_or_err;
+  if (ts) {
+    if (PdbAstBuilder *ast_builder = ts->GetNativePDBParser())
+      ast_builder->EnsureFunction(func_id);
   }
 
   return func_sp;

>From 9c14013175a49474f22d8115a466130b49b1c89f Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Sat, 31 Oct 2026 21:51:34 +0100
Subject: [PATCH 4/5] fix: break, don't return

---
 .../source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index c7ad77c47edcce..c6e43b5a0028ee 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -2795,7 +2795,7 @@ size_t SymbolFileNativePDB::ParseVariablesForBlock(PdbCompilandSymId block_id) {
       return 0;
     }
     if (proc.FunctionType.isNoneType())
-      return 0;
+      break;
 
     CVType signature = m_index->tpi().getType(proc.FunctionType);
     if (signature.kind() == LF_PROCEDURE) {

>From f0aed1f512750a103febd77bd505de85aff53385 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Sat, 31 Oct 2026 21:51:58 +0100
Subject: [PATCH 5/5] fix: test message and regex

---
 .../Shell/SymbolFile/NativePDB/line-tables-only-decl.test | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
index 0a3fe69525224a..4f329b243e8ba7 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
+++ b/lldb/test/Shell/SymbolFile/NativePDB/line-tables-only-decl.test
@@ -1,4 +1,4 @@
-# Check that lldb can generate a backtrace when fed with a PDB without locals or function types.
+# Check that lldb parses functions and inlined call sites (with their decl lines) from a PDB without locals or function types.
 
 # RUN: llvm-pdbutil yaml2pdb %p/Inputs/line-tables-only-pdb.yaml --pdb=%t
 # RUN: lldb-test symbols %t | FileCheck %s
@@ -9,9 +9,9 @@
 # CHECK-NEXT:     Block{{.*}}, ranges = [0x00000fff-0x0000100e)
 # CHECK-NEXT:     Function{{.*}}, demangled = foo
 # CHECK-NEXT:     Block{{.*}}, ranges = [0x0000100f-0x0000105a)
-# CHECK-NEXT:       Block{{.*}}, parent = {0x12400001}, name = "inlineme", decl = line-tables-only.cpp:11, ranges = [0x00001023-0x00001055)
-# CHECK-NEXT:         Block{{.*}}, parent = {0x17c00001}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x0000102b-0x0000103b)
-# CHECK-NEXT:         Block{{.*}}, parent = {0x17c00001}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x00001043-0x00001053)
+# CHECK-NEXT:       Block{{.*}}, parent = {{.*}}, name = "inlineme", decl = line-tables-only.cpp:11, ranges = [0x00001023-0x00001055)
+# CHECK-NEXT:         Block{{.*}}, parent = {{.*}}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x0000102b-0x0000103b)
+# CHECK-NEXT:         Block{{.*}}, parent = {{.*}}, name = "inlineme_too", decl = line-tables-only.cpp:6, ranges = [0x00001043-0x00001053)
 # CHECK-NEXT:     Function{{.*}}, demangled = main
 # CHECK-NEXT:     Block{{.*}}, ranges = [0x0000105f-0x00001076)
 # CHECK-NEXT:     Function{{.*}}, demangled = stopHere



More information about the lldb-commits mailing list