[Lldb-commits] [lldb] 5c71351 - [lldb][Module] Add logging when script import fails (#189695)

via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 31 10:52:19 PDT 2026


Author: Michael Buch
Date: 2026-03-31T17:52:13Z
New Revision: 5c71351cf79471845aaa94fff187b9c9d0ac145f

URL: https://github.com/llvm/llvm-project/commit/5c71351cf79471845aaa94fff187b9c9d0ac145f
DIFF: https://github.com/llvm/llvm-project/commit/5c71351cf79471845aaa94fff187b9c9d0ac145f.diff

LOG: [lldb][Module] Add logging when script import fails (#189695)

We already log the import attempt. This patch logs the failure to load
the script since otherwise the log may be misleading. Didn't think it
was worth adding a test-case for this.

Added: 
    

Modified: 
    lldb/source/Core/Module.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index aad23c0486805..95772f72d7e70 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1433,6 +1433,8 @@ static bool LoadScriptingModule(const FileSpec &scripting_fspec,
 }
 
 bool Module::LoadScriptingResourceInTarget(Target *target, Status &error) {
+  Log *log = GetLog(LLDBLog::Modules);
+
   if (!target) {
     error = Status::FromErrorString("invalid destination Target");
     return false;
@@ -1498,12 +1500,14 @@ To run all discovered debug scripts in this session:
       return false;
     }
 
-    LLDB_LOG(GetLog(LLDBLog::Modules), "Auto-loading {0}",
-             scripting_fspec.GetPath());
+    LLDB_LOG(log, "Auto-loading {0}", scripting_fspec.GetPath());
 
     if (!LoadScriptingModule(scripting_fspec, *script_interpreter, *target,
-                             error))
+                             error)) {
+      LLDB_LOG(log, "Failed to load '{0}'. Remaining scripts won't be loaded.",
+               scripting_fspec.GetPath());
       return false;
+    }
   }
 
   return true;


        


More information about the lldb-commits mailing list