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

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


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

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

>From b762fad17ed879f4696b619c748d5ad02bb3ee92 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Mon, 14 Sep 2026 18:01:40 -0700
Subject: [PATCH] [lldb] Report an error when a debug map object file is
 missing

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
---
 .../SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp      |  2 ++
 lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp      | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 lldb/test/Shell/SymbolFile/DWARF/missing-oso.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 24aeae71e365e..57d844bd587f0 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 0000000000000..1c339fc58956a
--- /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; }



More information about the lldb-commits mailing list