[Lldb-commits] [lldb] [lldb][Module] Only call LoadScriptingResourceInTarget via ModuleList (PR #190136)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 2 08:44:37 PDT 2026
================
@@ -1332,6 +1332,90 @@ bool ModuleList::RemoveSharedModuleIfOrphaned(const ModuleWP module_wp) {
return GetSharedModuleList().RemoveIfOrphaned(module_wp);
}
+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 ModuleList::LoadScriptingResourceInTargetForModule(Module &module,
+ Target &target,
+ Status &error) {
+ Log *log = GetLog(LLDBLog::Modules);
+
+ Debugger &debugger = target.GetDebugger();
+ const ScriptLanguage script_language = debugger.GetScriptLanguage();
+ if (script_language == eScriptLanguageNone)
+ return true;
+
+ ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
+ if (!script_interpreter) {
+ error = Status::FromErrorString("invalid ScriptInterpreter");
+ return false;
+ }
+
+ PlatformSP platform_sp(target.GetPlatform());
+
+ if (!platform_sp) {
----------------
JDevlieghere wrote:
```suggestion
PlatformSP platform_sp = target.GetPlatform();
if (!platform_sp) {
```
https://github.com/llvm/llvm-project/pull/190136
More information about the lldb-commits
mailing list