1
- """Test stepping over watchpoints."""
1
+ """Test stepping over watchpoints and instruction stepping past watchpoints ."""
2
2
3
3
4
4
import lldb
@@ -11,11 +11,25 @@ class TestStepOverWatchpoint(TestBase):
11
11
NO_DEBUG_INFO_TESTCASE = True
12
12
13
13
def get_to_start (self , bkpt_text ):
14
- """Test stepping over watchpoints."""
14
+ """Test stepping over watchpoints and instruction stepping past watchpoints. ."""
15
15
self .build ()
16
16
target , process , thread , bkpt = lldbutil .run_to_source_breakpoint (
17
17
self , bkpt_text , lldb .SBFileSpec ("main.c" )
18
18
)
19
+ return (target , process , thread , frame , read_watchpoint )
20
+
21
+ @add_test_categories (["basic_process" ])
22
+ @expectedFailureAll (
23
+ oslist = ["ios" , "watchos" , "tvos" , "bridgeos" , "macosx" ],
24
+ archs = ["aarch64" , "arm" ],
25
+ bugnumber = "<rdar://problem/106868647>" ,
26
+ )
27
+ def test_step_over_read_watchpoint (self ):
28
+ self .build ()
29
+ target , process , thread , bkpt = lldbutil .run_to_source_breakpoint (
30
+ self , "break here for read watchpoints" , lldb .SBFileSpec ("main.c" )
31
+ )
32
+
19
33
frame = thread .GetFrameAtIndex (0 )
20
34
self .assertTrue (frame .IsValid (), "Failed to get frame." )
21
35
@@ -33,14 +47,6 @@ def get_to_start(self, bkpt_text):
33
47
# stepping off from the breakpoint:
34
48
bkpt .SetEnabled (False )
35
49
36
- return (target , process , thread , frame , read_watchpoint )
37
-
38
- # Read-write watchpoints not supported on SystemZ
39
- @expectedFailureAll (archs = ["s390x" ])
40
- @add_test_categories (["basic_process" ])
41
- def test_step_over (self ):
42
- target , process , thread , frame , wp = self .get_to_start ("Set a breakpoint here" )
43
-
44
50
thread .StepOver ()
45
51
self .assertStopReason (
46
52
thread .GetStopReason (),
@@ -49,39 +55,36 @@ def test_step_over(self):
49
55
)
50
56
self .assertEquals (thread .GetStopDescription (20 ), "watchpoint 1" )
51
57
52
- # Skip everywhere while modify watchpoints are sorted out.
53
- @skipTestIfFn (lambda : True )
54
- @expectedFailureAll (
55
- oslist = ["freebsd" , "linux" ],
56
- archs = ["aarch64" , "arm" ],
57
- bugnumber = "llvm.org/pr26031" ,
58
- )
59
- # Read-write watchpoints not supported on SystemZ
60
- @expectedFailureAll (archs = ["s390x" ])
58
+ process .Continue ()
59
+ self .assertState (process .GetState (), lldb .eStateStopped , PROCESS_STOPPED )
60
+ self .assertEquals (thread .GetStopDescription (20 ), "step over" )
61
+
62
+ self .step_inst_for_watchpoint (1 )
63
+
64
+ @add_test_categories (["basic_process" ])
61
65
@expectedFailureAll (
62
66
oslist = ["ios" , "watchos" , "tvos" , "bridgeos" , "macosx" ],
63
67
archs = ["aarch64" , "arm" ],
64
- bugnumber = "<rdar://problem/34027183 >" ,
68
+ bugnumber = "<rdar://problem/106868647 >" ,
65
69
)
66
- @ add_test_categories ([ "basic_process" ])
67
- def test_step_instruction ( self ):
68
- target , process , thread , frame , wp = self . get_to_start (
69
- "Set breakpoint after call"
70
+ def test_step_over_write_watchpoint ( self ):
71
+ self . build ()
72
+ target , process , thread , bkpt = lldbutil . run_to_source_breakpoint (
73
+ self , "break here for modify watchpoints" , lldb . SBFileSpec ( "main.c" )
70
74
)
71
75
72
- self .step_inst_for_watchpoint (1 )
76
+ # Disable the breakpoint we hit so we don't muddy the waters with
77
+ # stepping off from the breakpoint:
78
+ bkpt .SetEnabled (False )
79
+
80
+ frame = thread .GetFrameAtIndex (0 )
81
+ self .assertTrue (frame .IsValid (), "Failed to get frame." )
73
82
74
83
write_value = frame .FindValue ("g_watch_me_write" , lldb .eValueTypeVariableGlobal )
75
84
self .assertTrue (write_value , "Failed to find write value." )
76
85
77
- # Most of the MIPS boards provide only one H/W watchpoints, and S/W
78
- # watchpoints are not supported yet
79
- arch = self .getArchitecture ()
80
- if re .match ("^mips" , arch ) or re .match ("powerpc64le" , arch ):
81
- self .runCmd ("watchpoint delete 1" )
82
-
83
86
error = lldb .SBError ()
84
- # resolve_location=True, read=False, write =True
87
+ # resolve_location=True, read=False, modify =True
85
88
write_watchpoint = write_value .Watch (True , False , True , error )
86
89
self .assertTrue (write_watchpoint , "Failed to set write watchpoint." )
87
90
self .assertSuccess (error , "Error while setting watchpoint" )
@@ -92,13 +95,13 @@ def test_step_instruction(self):
92
95
lldb .eStopReasonWatchpoint ,
93
96
STOPPED_DUE_TO_WATCHPOINT ,
94
97
)
95
- self .assertEquals (thread .GetStopDescription (20 ), "watchpoint 2 " )
98
+ self .assertEquals (thread .GetStopDescription (20 ), "watchpoint 1 " )
96
99
97
100
process .Continue ()
98
101
self .assertState (process .GetState (), lldb .eStateStopped , PROCESS_STOPPED )
99
102
self .assertEquals (thread .GetStopDescription (20 ), "step over" )
100
103
101
- self .step_inst_for_watchpoint (2 )
104
+ self .step_inst_for_watchpoint (1 )
102
105
103
106
def step_inst_for_watchpoint (self , wp_id ):
104
107
watchpoint_hit = False
0 commit comments