[Lldb-commits] [lldb] 5326b3b - [lldb][test] Only assert function name is in user-code on Darwin platforms
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 8 14:49:11 PDT 2025
Author: Michael Buch
Date: 2025-09-08T22:48:34+01:00
New Revision: 5326b3b176e82191b18ffc368118b36e0103af3d
URL: https://github.com/llvm/llvm-project/commit/5326b3b176e82191b18ffc368118b36e0103af3d
DIFF: https://github.com/llvm/llvm-project/commit/5326b3b176e82191b18ffc368118b36e0103af3d.diff
LOG: [lldb][test] Only assert function name is in user-code on Darwin platforms
The frame recognizer for the instrumentation runtimes (added in
https://github.com/llvm/llvm-project/pull/133079) only triggers on Darwin
for `libclang_rt`. Adjust the tests accordingly.
Added:
Modified:
lldb/test/API/functionalities/asan/TestMemoryHistory.py
lldb/test/API/functionalities/asan/TestReportData.py
lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/asan/TestMemoryHistory.py b/lldb/test/API/functionalities/asan/TestMemoryHistory.py
index a8f400de8ab08..8ae2d4a60d60c 100644
--- a/lldb/test/API/functionalities/asan/TestMemoryHistory.py
+++ b/lldb/test/API/functionalities/asan/TestMemoryHistory.py
@@ -2,7 +2,6 @@
Test that ASan memory history provider returns correct stack traces
"""
-
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -10,6 +9,7 @@
from lldbsuite.test import lldbutil
from lldbsuite.test_event.build_exception import BuildError
+
class MemoryHistoryTestCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@expectedFailureNetBSD
@@ -94,9 +94,10 @@ def libsanitizers_asan_tests(self):
)
self.check_traces()
- # Make sure we're not stopped in the sanitizer library but instead at the
- # point of failure in the user-code.
- self.assertEqual(self.frame().GetFunctionName(), "main")
+ if self.platformIsDarwin():
+ # Make sure we're not stopped in the sanitizer library but instead at the
+ # point of failure in the user-code.
+ self.assertEqual(self.frame().GetFunctionName(), "main")
# do the same using SB API
process = self.dbg.GetSelectedTarget().process
@@ -222,9 +223,10 @@ def compiler_rt_asan_tests(self):
self.check_traces()
- # Make sure we're not stopped in the sanitizer library but instead at the
- # point of failure in the user-code.
- self.assertEqual(self.frame().GetFunctionName(), "main")
+ if self.platformIsDarwin():
+ # Make sure we're not stopped in the sanitizer library but instead at the
+ # point of failure in the user-code.
+ self.assertEqual(self.frame().GetFunctionName(), "main")
# make sure the 'memory history' command still works even when we're
# generating a report now
diff --git a/lldb/test/API/functionalities/asan/TestReportData.py b/lldb/test/API/functionalities/asan/TestReportData.py
index ccc1b846d1607..c832436b0f447 100644
--- a/lldb/test/API/functionalities/asan/TestReportData.py
+++ b/lldb/test/API/functionalities/asan/TestReportData.py
@@ -2,7 +2,6 @@
Test the AddressSanitizer runtime support for report breakpoint and data extraction.
"""
-
import json
import lldb
from lldbsuite.test.decorators import *
@@ -10,6 +9,7 @@
from lldbsuite.test import lldbutil
from lldbsuite.test_event.build_exception import BuildError
+
class AsanTestReportDataCase(TestBase):
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
@expectedFailureNetBSD
@@ -67,9 +67,10 @@ def asan_tests(self, libsanitizers=False):
lldb.eStopReasonInstrumentation,
)
- # Make sure we're not stopped in the sanitizer library but instead at the
- # point of failure in the user-code.
- self.assertEqual(self.frame().GetFunctionName(), "main")
+ if self.platformIsDarwin():
+ # Make sure we're not stopped in the sanitizer library but instead at the
+ # point of failure in the user-code.
+ self.assertEqual(self.frame().GetFunctionName(), "main")
self.expect(
"bt",
diff --git a/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py b/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
index 2747b2b442195..51a28c5013071 100644
--- a/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
+++ b/lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
@@ -63,11 +63,14 @@ def tsan_tests(self):
substrs=["1 match found"],
)
- # We should not be stopped in the sanitizer library.
process = self.dbg.GetSelectedTarget().process
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
- self.assertIn("f2", frame.GetFunctionName())
+ if self.platformIsDarwin():
+ # We should not be stopped in the sanitizer library.
+ self.assertIn("f2", frame.GetFunctionName())
+ else:
+ self.assertIn("__tsan_on_report", frame.GetFunctionName())
# The stopped thread backtrace should contain either line1 or line2
# from main.c.
diff --git a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
index f46d167d910ea..9e9ea2114196e 100644
--- a/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
+++ b/lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
@@ -52,8 +52,11 @@ def ubsan_tests(self):
substrs=["1 match found"],
)
- # We should not be stopped in the sanitizer library.
- self.assertIn("main", frame.GetFunctionName())
+ if self.platformIsDarwin():
+ # We should not be stopped in the sanitizer library.
+ self.assertIn("main", frame.GetFunctionName())
+ else:
+ self.assertIn("__ubsan_on_report", frame.GetFunctionName())
# The stopped thread backtrace should contain either 'align line'
found = False
More information about the lldb-commits
mailing list