@@ -44,11 +44,23 @@ def step_out_with_scripted_plan(self, name):
44
44
stop_desc = thread .GetStopDescription (1000 )
45
45
self .assertIn ("Stepping out from" , stop_desc , "Got right description" )
46
46
47
- def test_step_single_instruction (self ):
47
+ def run_until_branch_instruction (self ):
48
48
self .build ()
49
49
(target , process , thread , bkpt ) = lldbutil .run_to_source_breakpoint (
50
- self , "Break on foo call" , self .main_source_file
50
+ self , "Break on branch instruction" , self .main_source_file
51
+ )
52
+
53
+ # Check that we landed in a call instruction
54
+ frame = thread .GetFrameAtIndex (0 )
55
+ current_instruction = target .ReadInstructions (frame .GetPCAddress (), 1 )[0 ]
56
+ self .assertEqual (
57
+ lldb .eInstructionControlFlowKindCall ,
58
+ current_instruction .GetControlFlowKind (target ),
51
59
)
60
+ return (target , process , thread , bkpt )
61
+
62
+ def test_step_single_instruction (self ):
63
+ (target , process , thread , bkpt ) = self .run_until_branch_instruction ()
52
64
53
65
err = thread .StepUsingScriptedThreadPlan ("Steps.StepSingleInstruction" )
54
66
self .assertSuccess (err )
@@ -58,10 +70,11 @@ def test_step_single_instruction(self):
58
70
self .assertEqual ("foo" , frame .GetFunctionName ())
59
71
60
72
def test_step_single_instruction_with_step_over (self ):
61
- self .build ()
62
- (target , process , thread , bkpt ) = lldbutil .run_to_source_breakpoint (
63
- self , "Break on foo call" , self .main_source_file
64
- )
73
+ (target , process , thread , bkpt ) = self .run_until_branch_instruction ()
74
+
75
+ frame = thread .GetFrameAtIndex (0 )
76
+ next_instruction = target .ReadInstructions (frame .GetPCAddress (), 2 )[1 ]
77
+ next_instruction_address = next_instruction .GetAddress ()
65
78
66
79
err = thread .StepUsingScriptedThreadPlan (
67
80
"Steps.StepSingleInstructionWithStepOver"
@@ -71,6 +84,7 @@ def test_step_single_instruction_with_step_over(self):
71
84
# Verify that stepping over an instruction doesn't step into `foo`
72
85
frame = thread .GetFrameAtIndex (0 )
73
86
self .assertEqual ("main" , frame .GetFunctionName ())
87
+ self .assertEqual (next_instruction_address , frame .GetPCAddress ())
74
88
75
89
def test_misspelled_plan_name (self ):
76
90
"""Test that we get a useful error if we misspell the plan class name"""
0 commit comments