9
9
from lldbsuite .test import lldbplatform
10
10
from lldbsuite .test import lldbutil
11
11
12
- from functionalities .libsanitizers .util import no_libsanitizers
13
12
14
13
class AsanTestCase (TestBase ):
15
14
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
16
15
@expectedFailureNetBSD
17
16
@skipUnlessAddressSanitizer
18
17
def test (self ):
19
- self .build (make_targets = [ "asan" ] )
18
+ self .build ()
20
19
self .asan_tests ()
21
20
22
- @skipIf (oslist = no_match (["macosx" ]))
23
- def test_libsanitizers_asan (self ):
24
- self .build (make_targets = ["libsanitizers" ])
25
- self .libsanitizer_tests ()
26
-
27
21
def setUp (self ):
28
22
# Call super's setUp().
29
23
TestBase .setUp (self )
@@ -32,71 +26,6 @@ def setUp(self):
32
26
self .line_free = line_number ("main.c" , "// free line" )
33
27
self .line_breakpoint = line_number ("main.c" , "// break line" )
34
28
35
- # Test line numbers: rdar://126237493
36
- def libsanitizer_tests (self ):
37
- target = self .createTestTarget ()
38
-
39
- if no_libsanitizers (self ):
40
- self .skipTest ("libsanitizers not found" )
41
-
42
- self .runCmd (
43
- "env SanitizersAddress=1 MallocSanitizerZone=1 MallocSecureAllocator=0"
44
- )
45
-
46
- self .runCmd ("run" )
47
-
48
- # In libsanitizers, memory history is not supported until a report has been generated
49
- self .expect (
50
- "thread list" ,
51
- "Process should be stopped due to ASan report" ,
52
- substrs = ["stopped" , "stop reason = Use of deallocated memory" ],
53
- )
54
-
55
- # test the 'memory history' command
56
- self .expect (
57
- "memory history 'pointer'" ,
58
- substrs = [
59
- "Memory deallocated by Thread" ,
60
- "a.out`f2" ,
61
- "main.c" ,
62
- "Memory allocated by Thread" ,
63
- "a.out`f1" ,
64
- "main.c" ,
65
- ],
66
- )
67
-
68
- # do the same using SB API
69
- process = self .dbg .GetSelectedTarget ().process
70
- val = (
71
- process .GetSelectedThread ().GetSelectedFrame ().EvaluateExpression ("pointer" )
72
- )
73
- addr = val .GetValueAsUnsigned ()
74
- threads = process .GetHistoryThreads (addr )
75
- self .assertEqual (threads .GetSize (), 2 )
76
-
77
- history_thread = threads .GetThreadAtIndex (0 )
78
- self .assertTrue (history_thread .num_frames >= 2 )
79
- self .assertEqual (
80
- history_thread .frames [1 ].GetLineEntry ().GetFileSpec ().GetFilename (),
81
- "main.c" ,
82
- )
83
-
84
- history_thread = threads .GetThreadAtIndex (1 )
85
- self .assertTrue (history_thread .num_frames >= 2 )
86
- self .assertEqual (
87
- history_thread .frames [1 ].GetLineEntry ().GetFileSpec ().GetFilename (),
88
- "main.c" ,
89
- )
90
-
91
- # let's free the container (SBThreadCollection) and see if the
92
- # SBThreads still live
93
- threads = None
94
- self .assertTrue (history_thread .num_frames >= 2 )
95
- self .assertEqual (
96
- history_thread .frames [1 ].GetLineEntry ().GetFileSpec ().GetFilename (),
97
- "main.c" ,
98
- )
99
-
100
29
def asan_tests (self ):
101
30
target = self .createTestTarget ()
102
31
0 commit comments