[Lldb-commits] [lldb] [lldb] Add std::source_location summary provider (PR #203185)

Sergei Druzhkov via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 12 02:30:52 PDT 2026


================
@@ -0,0 +1,53 @@
+"""
+Test std::source_location summary.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdSourceLocationTestCase(TestBase):
+    SHARED_BUILD_TESTCASE = False
+    TEST_WITH_PDB_DEBUG_INFO = True
+
+    def do_test(self):
+        lldbutil.run_to_source_breakpoint(
+            self, "// break here", lldb.SBFileSpec("main.cpp")
+        )
+
+        frame = self.frame()
+
+        loc_main = frame.FindVariable("loc_main")
+        self.assertTrue(loc_main.GetError().Success())
+        self.assertRegex(loc_main.summary, r"main\.cpp\":\d+:\d+ \(\"int main\(\)\"\)")
+
+        loc_foo = frame.FindVariable("loc_foo")
+        self.assertTrue(loc_foo.GetError().Success())
+        self.assertRegex(
+            loc_foo.summary, r"main\.cpp\":\d+:\d+ \(\"std::source_location foo\(\)\"\)"
----------------
DrSergei wrote:

Column numbers are not stable across compilers (see example below):

clang:
<img width="346" height="76" alt="image" src="https://github.com/user-attachments/assets/e4a59912-9c4a-4dfe-bdb8-a4bb91fd7ebb" />

g++:
<img width="331" height="61" alt="image" src="https://github.com/user-attachments/assets/12d37175-1262-4e8d-a0da-e55c0b84ccc5" />

I think we can use fixed line numbers, but keep regex for columns. WDYT?

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


More information about the lldb-commits mailing list