[Lldb-commits] [lldb] [lldb] Add ScriptedSymbolLocator plugin for source file resolution (PR #181334)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 13 08:09:40 PST 2026


================
@@ -0,0 +1,156 @@
+"""
+Test the ScriptedSymbolLocator plugin for source file resolution.
+"""
+
+import os
+import shutil
+import tempfile
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ScriptedSymbolLocatorTestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def setUp(self):
+        TestBase.setUp(self)
+        self.main_source_file = lldb.SBFileSpec("main.c")
+
+    def import_locator(self):
+        self.runCmd(
+            "command script import "
+            + os.path.join(self.getSourceDir(), "source_locator.py")
+        )
+
+    def set_locator_class(self, class_name):
+        self.runCmd(
+            "settings set plugin.symbol-locator.scripted.script-class " + class_name
+        )
+
+    def clear_locator_class(self):
+        self.runCmd('settings set plugin.symbol-locator.scripted.script-class ""')
+
+    def script(self, expr):
+        """Execute a Python expression in LLDB's script interpreter and return
+        the result as a string."""
+        ret = lldb.SBCommandReturnObject()
+        self.dbg.GetCommandInterpreter().HandleCommand("script " + expr, ret)
+        return ret.GetOutput().strip() if ret.Succeeded() else ""
+
+    @skipUnlessPlatform(["linux", "freebsd"])
----------------
medismailben wrote:

Why can't these tests run on Darwin ?

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


More information about the lldb-commits mailing list