[Lldb-commits] [lldb] [lldb] Add `scripting extension instances` command (PR #226043)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 25 11:59:18 PDT 2026


================
@@ -2672,6 +2672,21 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
   if (error.Fail())
     return false;
 
+  // __lldb_init_module may instantiate extensions from the module, so the
+  // path must be known before it runs.
+  if (llvm::Expected<PythonModule> py_module =
+          PythonModule::Import(module_name)) {
+    PythonObject py_file = py_module->GetAttributeValue("__file__");
+    if (PythonString::Check(py_file.get())) {
+      FileSpec module_path(
+          PythonString(PyRefType::Borrowed, py_file.get()).GetString());
+      FileSystem::Instance().Resolve(module_path);
+      SetImportedModulePath(module_name, module_path);
+    }
+  } else {
+    llvm::consumeError(py_module.takeError());
----------------
JDevlieghere wrote:

Should this be logged?

https://github.com/llvm/llvm-project/pull/226043


More information about the lldb-commits mailing list