[Lldb-commits] [lldb] [lldb] Keep the existing behavior for untrusted dSYMs (PR #190407)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 3 14:58:29 PDT 2026
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/190407
>From a168336a6092cbd6329a6a96da110140e51f11b1 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 3 Apr 2026 14:12:21 -0700
Subject: [PATCH 1/2] [lldb] Keep the existing behavior for untrusted dSYMs
This patch does two thing:
- It reverts to the previous behavior of warning for untrusted dSYMs.
- It includes whether a dSYM is trusted or untrusted in the warning
output.
My reasoning is that there's no tooling for automatically signing dSYMs
and therefore we shouldn't change the behavior until this is more
common. The inclusion of whether the dSYM is signed or not is the first
step towards advertising the existence of the feature.
This now also means the release note I added in #189444 is correct
(again).
---
lldb/source/Core/ModuleList.cpp | 18 ++++++++++++------
.../dsym-python-script-name-warnings.test | 2 +-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index fae42cb90a7fb..fd374221cbeca 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1374,25 +1374,30 @@ bool ModuleList::LoadScriptingResourceInTargetForModule(Module &module,
debugger.ReportWarning(feedback_stream.GetString().str(), debugger.GetID());
for (const auto &[scripting_fspec, load_style] : file_specs) {
+ if (load_style == eLoadScriptFromSymFileFalse)
+ continue;
+
if (!FileSystem::Instance().Exists(scripting_fspec))
continue;
+ const bool trusted = platform_sp->IsSymbolFileTrusted(module);
+
switch (load_style) {
case eLoadScriptFromSymFileFalse:
- continue;
+ llvm_unreachable("case already handled");
case eLoadScriptFromSymFileTrue:
break;
case eLoadScriptFromSymFileTrusted:
- if (!platform_sp->IsSymbolFileTrusted(module))
- continue;
- break;
+ if (trusted)
+ break;
+ LLVM_FALLTHROUGH;
case eLoadScriptFromSymFileWarn:
debugger.ReportWarning(
llvm::formatv(
// clang-format off
-R"('{0}' contains a debug script. To run this script in this debug session:
+R"('{0}' contains {1} debug script. To run this script in this debug session:
- command script import "{1}"
+ command script import "{2}"
To run all discovered debug scripts in this session:
@@ -1400,6 +1405,7 @@ To run all discovered debug scripts in this session:
)",
// clang-format on
module.GetFileSpec().GetFileNameStrippingExtension(),
+ trusted ? "a trusted" : "an untrusted",
scripting_fspec.GetPath()),
debugger.GetID());
diff --git a/lldb/test/Shell/Platform/AutoLoad/Darwin/dsym-python-script-name-warnings.test b/lldb/test/Shell/Platform/AutoLoad/Darwin/dsym-python-script-name-warnings.test
index 9c84045d75932..07fa3c0d6e679 100644
--- a/lldb/test/Shell/Platform/AutoLoad/Darwin/dsym-python-script-name-warnings.test
+++ b/lldb/test/Shell/Platform/AutoLoad/Darwin/dsym-python-script-name-warnings.test
@@ -33,7 +33,7 @@
## Also confirm that the warning message about auto-loading scripts is printed afterwards.
-# CHECK-REMOVE: warning: 'Test-Module2' contains a debug script. To run this script in this
+# CHECK-REMOVE: warning: 'Test-Module2' contains an untrusted debug script. To run this script in this
#--- main.c
int main() { return 0; }
>From f175d78f10b3b944a36dc8e391d3ba981c981479 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Fri, 3 Apr 2026 14:56:14 -0700
Subject: [PATCH 2/2] Replace return with continue
---
lldb/source/Core/ModuleList.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index fd374221cbeca..d3c52cfe7d8f3 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1373,6 +1373,8 @@ bool ModuleList::LoadScriptingResourceInTargetForModule(Module &module,
if (!feedback_stream.Empty())
debugger.ReportWarning(feedback_stream.GetString().str(), debugger.GetID());
+ const bool trusted = platform_sp->IsSymbolFileTrusted(module);
+
for (const auto &[scripting_fspec, load_style] : file_specs) {
if (load_style == eLoadScriptFromSymFileFalse)
continue;
@@ -1380,8 +1382,6 @@ bool ModuleList::LoadScriptingResourceInTargetForModule(Module &module,
if (!FileSystem::Instance().Exists(scripting_fspec))
continue;
- const bool trusted = platform_sp->IsSymbolFileTrusted(module);
-
switch (load_style) {
case eLoadScriptFromSymFileFalse:
llvm_unreachable("case already handled");
@@ -1409,7 +1409,7 @@ To run all discovered debug scripts in this session:
scripting_fspec.GetPath()),
debugger.GetID());
- return false;
+ continue;
}
LLDB_LOG(log, "Auto-loading {0}", scripting_fspec.GetPath());
More information about the lldb-commits
mailing list