Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions lldb/source/Core/ModuleList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,37 +1373,43 @@ 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;

if (!FileSystem::Instance().Exists(scripting_fspec))
continue;

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:

settings set target.load-script-from-symbol-file true
)",
// clang-format on
module.GetFileSpec().GetFileNameStrippingExtension(),
trusted ? "a trusted" : "an untrusted",
scripting_fspec.GetPath()),
debugger.GetID());

return false;
continue;
}

LLDB_LOG(log, "Auto-loading {0}", scripting_fspec.GetPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }