[Lldb-commits] [lldb] [lldb] Add SBFunction::GetBaseName() & SBSymbol::GetBaseName() (PR #155939)

via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 28 16:48:42 PDT 2025


================
@@ -0,0 +1,53 @@
+"""
+Test SBFunction::GetBaseName() and SBSymbol::GetBaseName() APIs.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class GetBaseNameTestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        # Find the line number to break on.
+        self.line1 = line_number(
+            "main.cpp", "// Find the line number for breakpoint 1 here."
+        )
+
+    def test(self):
+        """Test SBFunction.GetBaseName() and SBSymbol.GetBaseName()"""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+
+        # Create a target by the debugger.
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        # Create a breakpoint inside the C++ namespaced function.
+        breakpoint1 = target.BreakpointCreateByLocation("main.cpp", self.line1)
+
+        # Now launch the process, and do not stop at entry point.
+        process = target.LaunchSimple(None, None, self.get_process_working_directory())
+
----------------
jimingham wrote:

We don't tend to write tests this way anymore, we use the lldbutils.run_to_source_breakpoint - it's much more readable, and does the error checking better.

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


More information about the lldb-commits mailing list