[Lldb-commits] [lldb] [LLDB] Add integration test for libsanitizers trace collection (PR #134323)

Julian Lettner via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 4 16:12:53 PDT 2025


================
@@ -36,35 +42,59 @@ def setUp(self):
         self.line_breakpoint = line_number("main.c", "// break line")
 
     # Test line numbers: rdar://126237493
-    def libsanitizer_tests(self):
-        target = self.createTestTarget()
-
-        self.runCmd(
-            "env SanitizersAddress=1 MallocSanitizerZone=1 MallocSecureAllocator=0"
-        )
-
-        self.runCmd("run")
-
-        # In libsanitizers, memory history is not supported until a report has been generated
-        self.expect(
-            "thread list",
-            "Process should be stopped due to ASan report",
-            substrs=["stopped", "stop reason = Use of deallocated memory"],
-        )
-
-        # test the 'memory history' command
+    # for libsanitizers and remove `skip_line_numbers` parameter
+    def check_traces(self, skip_line_numbers=False):
         self.expect(
             "memory history 'pointer'",
             substrs=[
                 "Memory deallocated by Thread",
                 "a.out`f2",
-                "main.c",
+                "main.c" if skip_line_numbers else f"main.c:{self.line_free}",
                 "Memory allocated by Thread",
                 "a.out`f1",
-                "main.c",
+                "main.c" if skip_line_numbers else f"main.c:{self.line_malloc}",
             ],
         )
 
+    # Set breakpoint after free, but before bug
+    def set_breakpoint(self):
+        self.runCmd(f"breakpoint set -f main.c -l {self.line_breakpoint}")
----------------
yln wrote:

Addressed by: 7d65214

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


More information about the lldb-commits mailing list