================ @@ -44,6 +44,34 @@ def step_out_with_scripted_plan(self, name): stop_desc = thread.GetStopDescription(1000) self.assertIn("Stepping out from", stop_desc, "Got right description") + def test_step_single_instruction(self): + self.build() + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "Break on foo call", self.main_source_file + ) + + err = thread.StepUsingScriptedThreadPlan("Steps.StepSingleInstruction") + self.assertSuccess(err) + + # Verify that stepping a single instruction after "foo();" steps into `foo` + frame = thread.GetFrameAtIndex(0) + self.assertEqual("foo", frame.GetFunctionName()) + + def test_step_single_instruction_with_step_over(self): + self.build() + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "Break on foo call", self.main_source_file + ) + + err = thread.StepUsingScriptedThreadPlan( + "Steps.StepSingleInstructionWithStepOver" + ) + self.assertSuccess(err) + + # Verify that stepping over an instruction doesn't step into `foo` + frame = thread.GetFrameAtIndex(0) + self.assertEqual("main", frame.GetFunctionName()) ---------------- jimingham wrote:
You might also assert before the nexti that you really are at a branch (you can get the instruction list for the function, find the instruction you are stopped at and ask it IsBranch. It seems really unlikely that any compiler/architecture would do more for a call to a `void (*)(void)` would emit more than a single branch and link, but it's better not to rely on that. https://github.com/llvm/llvm-project/pull/137904 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits