[Lldb-commits] [lldb] [lldb] Report an error when a debug map object file is missing (PR #223576)

via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 14 18:03:48 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

When an OSO in the debug map does not exist on disk, LLDB records the load error on the CompileUnitInfo but never surfaces it. The sibling mod-time-mismatch branch does report, so a stale .o produces a diagnostic while a deleted one fails silently.

This is easy to hit with LTO. The linker writes the merged object to a temporary path and deletes it, so unless the build passes -object_path_lto the debug map points at a file that is already gone.

rdar://162327417

---
Full diff: https://github.com/llvm/llvm-project/pull/223576.diff


2 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (+2) 
- (added) lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp (+11) 


``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 24aeae71e365e1..57d844bd587f0e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -450,6 +450,8 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
               "debug map object file \"%s\" containing debug info does not "
               "exist, debug info will not be loaded",
               comp_unit_info->oso_path.GetCString());
+          obj_file->GetModule()->ReportError(
+              "{0}", comp_unit_info->oso_load_error.AsCString());
           return nullptr;
         }
       }
diff --git a/lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp b/lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp
new file mode 100644
index 00000000000000..1c339fc58956a3
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp
@@ -0,0 +1,11 @@
+// Test that lldb reports an error when a debug map object file is missing,
+// instead of silently dropping the debug info for that object file.
+// REQUIRES: system-darwin
+// RUN: %clang_host %s -g -c -o %t.o
+// RUN: %clang_host %t.o -g -o %t
+// RUN: rm %t.o
+// RUN: %lldb %t -o "breakpoint set -f %s -l 10" -o exit 2>&1 | FileCheck %s
+
+// CHECK: error: {{.*}}.o" containing debug info does not exist, debug info will not be loaded
+
+int main() { return 0; }

``````````

</details>


https://github.com/llvm/llvm-project/pull/223576


More information about the lldb-commits mailing list