aprantl created this revision. aprantl added reviewers: jingham, Michael137. Herald added a subscriber: kristof.beyls. Herald added a project: All. aprantl requested review of this revision.
Depending on the compiler I've seen that for example the step-in command can do a column-step first before exiting out of the function: * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x0000000100003d80 a.out`called_from_nodebug_actual(some_value=5) at with-debug. c:10:10 2 3 typedef int (*debug_callee) (int); 4 5 extern int no_debug_caller (int, debug_callee); 6 7 int called_from_nodebug_actual(int some_value) { 8 int return_value = 0; 9 return_value = printf("Length: %d.\n", some_value); -> 10 return return_value; // Stop here and step out of me ^ 11 } 12 13 int called_from_nodebug(int some_value) { 14 int intermediate_return_value = 0; 15 intermediate_return_value = called_from_nodebug_actual(some_value); 16 return intermediate_return_value; 17 } 18 Process 58672 launched: '/Volumes/Data/llvm-project/_build.ninja.release/lldb-test-build.noindex/functionalities/step-avoids-no-debug/TestStepNoDebug.test_step_out_with_python_dsym/a.out' (arm64) (lldb) s Process 58672 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = step in frame #0: 0x0000000100003d8c a.out`called_from_nodebug_actual(some_value=5) at with-debug.c:10:3 2 3 typedef int (*debug_callee) (int); 4 5 extern int no_debug_caller (int, debug_callee); 6 7 int called_from_nodebug_actual(int some_value) { 8 int return_value = 0; 9 return_value = printf("Length: %d.\n", some_value); -> 10 return return_value; // Stop here and step out of me ^ 11 } 12 https://reviews.llvm.org/D152560 Files: lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py lldb/test/API/functionalities/step-avoids-no-debug/with-debug.c lldb/test/API/functionalities/step-avoids-no-debug/without-debug.c
Index: lldb/test/API/functionalities/step-avoids-no-debug/without-debug.c =================================================================== --- lldb/test/API/functionalities/step-avoids-no-debug/without-debug.c +++ lldb/test/API/functionalities/step-avoids-no-debug/without-debug.c @@ -1,16 +1,12 @@ -typedef int (*debug_callee) (int); +typedef int (*debug_callee)(int); -int -no_debug_caller_intermediate(int input, debug_callee callee) -{ +int no_debug_caller_intermediate(int input, debug_callee callee) { int return_value = 0; return_value = callee(input); return return_value; } -int -no_debug_caller (int input, debug_callee callee) -{ +int no_debug_caller(int input, debug_callee callee) { int return_value = 0; return_value = no_debug_caller_intermediate (input, callee); return return_value; Index: lldb/test/API/functionalities/step-avoids-no-debug/with-debug.c =================================================================== --- lldb/test/API/functionalities/step-avoids-no-debug/with-debug.c +++ lldb/test/API/functionalities/step-avoids-no-debug/with-debug.c @@ -4,26 +4,20 @@ extern int no_debug_caller (int, debug_callee); -int -called_from_nodebug_actual(int some_value) -{ +int called_from_nodebug_actual(int some_value) { int return_value = 0; - return_value = printf ("Length: %d.\n", some_value); + return_value = printf("Length: %d.\n", some_value); return return_value; // Stop here and step out of me } -int -called_from_nodebug(int some_value) -{ +int called_from_nodebug(int some_value) { int intermediate_return_value = 0; intermediate_return_value = called_from_nodebug_actual(some_value); return intermediate_return_value; } -int -main() -{ +int main() { int return_value = no_debug_caller(5, called_from_nodebug); - printf ("I got: %d.\n", return_value); + printf("I got: %d.\n", return_value); return 0; } Index: lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py =================================================================== --- lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py +++ lldb/test/API/functionalities/step-avoids-no-debug/TestStepNoDebug.py @@ -106,9 +106,9 @@ self.thread = threads[0] def do_step_out_past_nodebug(self): - # The first step out takes us to the called_from_nodebug frame, just to make sure setting - # step-out-avoid-nodebug doesn't change the behavior in frames with - # debug info. + # The first step out takes us to the called_from_nodebug + # frame, just to make sure setting step-out-avoid-nodebug + # doesn't change the behavior in frames with debug info. self.thread.StepOut() self.hit_correct_line( "intermediate_return_value = called_from_nodebug_actual(some_value)" @@ -119,33 +119,41 @@ ) def do_step_over_past_nodebug(self): - self.thread.StepOver() + while self.thread.frame[0].name == "called_from_nodebug_actual": + self.thread.StepOver() self.hit_correct_line( "intermediate_return_value = called_from_nodebug_actual(some_value)" ) self.thread.StepOver() self.hit_correct_line("return intermediate_return_value") - self.thread.StepOver() - # Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in" - # when exiting a frame. In all cases we leave the pc at the point where we exited the - # frame. In gdb, step-over/step-in move to the end of the line they stepped out to. - # If we ever change this we will need to fix this test. + while self.thread.frame[0].name == "called_from_nodebug": + self.thread.StepOver() + # Note, lldb doesn't follow gdb's distinction between + # "step-out" and "step-over/step-in" when exiting a frame. In + # all cases we leave the pc at the point where we exited the + # frame. In gdb, step-over/step-in move to the end of the + # line they stepped out to. If we ever change this we will + # need to fix this test. self.hit_correct_line( "int return_value = no_debug_caller(5, called_from_nodebug)" ) def do_step_in_past_nodebug(self): - self.thread.StepInto() + while self.thread.frame[0].name == "called_from_nodebug_actual": + self.thread.StepInto() self.hit_correct_line( "intermediate_return_value = called_from_nodebug_actual(some_value)" ) self.thread.StepInto() self.hit_correct_line("return intermediate_return_value") - self.thread.StepInto() - # Note, lldb doesn't follow gdb's distinction between "step-out" and "step-over/step-in" - # when exiting a frame. In all cases we leave the pc at the point where we exited the - # frame. In gdb, step-over/step-in move to the end of the line they stepped out to. - # If we ever change this we will need to fix this test. + while self.thread.frame[0].name == "called_from_nodebug": + self.thread.StepInto() + # Note, lldb doesn't follow gdb's distinction between + # "step-out" and "step-over/step-in" when exiting a frame. In + # all cases we leave the pc at the point where we exited the + # frame. In gdb, step-over/step-in move to the end of the + # line they stepped out to. If we ever change this we will + # need to fix this test. self.hit_correct_line( "int return_value = no_debug_caller(5, called_from_nodebug)" )
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits