[Lldb-commits] [lldb] 465f969 - [lldb][Module][NFC] Extract script loading logic into helper (#188712)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 26 02:42:57 PDT 2026
Author: Michael Buch
Date: 2026-03-26T09:42:52Z
New Revision: 465f96927df37e8dd90bf05ebd84b45cf71285db
URL: https://github.com/llvm/llvm-project/commit/465f96927df37e8dd90bf05ebd84b45cf71285db
DIFF: https://github.com/llvm/llvm-project/commit/465f96927df37e8dd90bf05ebd84b45cf71285db.diff
LOG: [lldb][Module][NFC] Extract script loading logic into helper (#188712)
Planning on re-using this within the same function. Extracting into
helper makes that slightly more readable.
Added:
Modified:
lldb/source/Core/Module.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index df73872c83685..3d33a5011fb5e 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1420,6 +1420,19 @@ bool Module::IsLoadedInTarget(Target *target) {
return false;
}
+static bool LoadScriptingModule(const FileSpec &scripting_fspec,
+ ScriptInterpreter &script_interpreter,
+ Target &target, Status &error) {
+ assert(scripting_fspec);
+
+ StreamString scripting_stream;
+ scripting_fspec.Dump(scripting_stream.AsRawOstream());
+ LoadScriptOptions options;
+ return script_interpreter.LoadScriptingModule(
+ scripting_stream.GetData(), options, error,
+ /*module_sp*/ nullptr, /*extra_path*/ {}, target.shared_from_this());
+}
+
bool Module::LoadScriptingResourceInTarget(Target *target, Status &error) {
if (!target) {
error = Status::FromErrorString("invalid destination Target");
@@ -1489,13 +1502,8 @@ To run all discovered debug scripts in this session:
LLDB_LOG(GetLog(LLDBLog::Modules), "Auto-loading {0}",
scripting_fspec.GetPath());
- StreamString scripting_stream;
- scripting_fspec.Dump(scripting_stream.AsRawOstream());
- LoadScriptOptions options;
- bool did_load = script_interpreter->LoadScriptingModule(
- scripting_stream.GetData(), options, error,
- /*module_sp*/ nullptr, /*extra_path*/ {}, target->shared_from_this());
- if (!did_load)
+ if (!LoadScriptingModule(scripting_fspec, *script_interpreter, *target,
+ error))
return false;
}
More information about the lldb-commits
mailing list