11
11
class TestStepOverWatchpoint (TestBase ):
12
12
NO_DEBUG_INFO_TESTCASE = True
13
13
14
- @expectedFailureAll (
15
- oslist = ["freebsd" , "linux" ],
16
- archs = [
17
- 'aarch64' ,
18
- 'arm' ],
19
- bugnumber = "llvm.org/pr26031" )
20
- @expectedFailureAll (oslist = ["linux" ], bugnumber = "bugs.swift.org/SR-796" )
21
- # Read-write watchpoints not supported on SystemZ
22
- @expectedFailureAll (archs = ['s390x' ])
23
- @expectedFailureAll (
24
- oslist = ["ios" , "watchos" , "tvos" , "bridgeos" , "macosx" ],
25
- archs = ['aarch64' , 'arm' ],
26
- bugnumber = "<rdar://problem/34027183>" )
27
- @add_test_categories (["basic_process" ])
28
- def test (self ):
14
+ def get_to_start (self , bkpt_text ):
29
15
"""Test stepping over watchpoints."""
30
16
self .build ()
31
- target = self .createTestTarget ()
32
-
33
- lldbutil .run_break_set_by_symbol (self , 'main' )
34
-
35
- process = target .LaunchSimple (None , None ,
36
- self .get_process_working_directory ())
37
- self .assertTrue (process .IsValid (), PROCESS_IS_VALID )
38
- self .assertState (process .GetState (), lldb .eStateStopped ,
39
- PROCESS_STOPPED )
40
-
41
- thread = lldbutil .get_stopped_thread (process ,
42
- lldb .eStopReasonBreakpoint )
43
- self .assertTrue (thread .IsValid (), "Failed to get thread." )
44
-
17
+ target , process , thread , bkpt = lldbutil .run_to_source_breakpoint (self , bkpt_text ,
18
+ lldb .SBFileSpec ("main.c" ))
45
19
frame = thread .GetFrameAtIndex (0 )
46
20
self .assertTrue (frame .IsValid (), "Failed to get frame." )
47
21
@@ -56,14 +30,45 @@ def test(self):
56
30
self .assertSuccess (error , "Error while setting watchpoint" )
57
31
self .assertTrue (read_watchpoint , "Failed to set read watchpoint." )
58
32
33
+ # Disable the breakpoint we hit so we don't muddy the waters with
34
+ # stepping off from the breakpoint:
35
+ bkpt .SetEnabled (False )
36
+
37
+ return (target , process , thread , frame , read_watchpoint )
38
+
39
+ @expectedFailureAll (
40
+ oslist = ["freebsd" , "linux" ],
41
+ archs = [
42
+ 'aarch64' ,
43
+ 'arm' ],
44
+ bugnumber = "llvm.org/pr26031" )
45
+ # Read-write watchpoints not supported on SystemZ
46
+ @expectedFailureAll (archs = ['s390x' ])
47
+ @add_test_categories (["basic_process" ])
48
+ def test_step_over (self ):
49
+ target , process , thread , frame , wp = self .get_to_start ("Set a breakpoint here" )
50
+
59
51
thread .StepOver ()
60
52
self .assertStopReason (thread .GetStopReason (), lldb .eStopReasonWatchpoint ,
61
53
STOPPED_DUE_TO_WATCHPOINT )
62
54
self .assertEquals (thread .GetStopDescription (20 ), 'watchpoint 1' )
63
55
64
- process .Continue ()
65
- self .assertState (process .GetState (), lldb .eStateStopped ,
66
- PROCESS_STOPPED )
56
+ @expectedFailureAll (
57
+ oslist = ["freebsd" , "linux" ],
58
+ archs = [
59
+ 'aarch64' ,
60
+ 'arm' ],
61
+ bugnumber = "llvm.org/pr26031" )
62
+ # Read-write watchpoints not supported on SystemZ
63
+ @expectedFailureAll (archs = ['s390x' ])
64
+ @expectedFailureAll (
65
+ oslist = ["ios" , "watchos" , "tvos" , "bridgeos" , "macosx" ],
66
+ archs = ['aarch64' , 'arm' ],
67
+ bugnumber = "<rdar://problem/34027183>" )
68
+ @add_test_categories (["basic_process" ])
69
+ def test_step_instruction (self ):
70
+ target , process , thread , frame , wp = self .get_to_start ("Set breakpoint after call" )
71
+
67
72
self .assertEquals (thread .GetStopDescription (20 ), 'step over' )
68
73
69
74
self .step_inst_for_watchpoint (1 )
@@ -78,6 +83,7 @@ def test(self):
78
83
if re .match ("^mips" , arch ) or re .match ("powerpc64le" , arch ):
79
84
self .runCmd ("watchpoint delete 1" )
80
85
86
+ error = lldb .SBError ()
81
87
# resolve_location=True, read=False, write=True
82
88
write_watchpoint = write_value .Watch (True , False , True , error )
83
89
self .assertTrue (write_watchpoint , "Failed to set write watchpoint." )
0 commit comments