When debugging a C++ program on Code::Blocks 20.03
, I press SHIFT+F7
to step into
the program, then I begin pressing F7
to go to the next line
and watch
variables changing in "real time".
But Code::Blocks 20.03's debugger won't enter any functions beside main
, making it pretty useless, or forcing me to not use any function besides main
(a bad programming practice).
How can I make Code::Blocks 20.03's debugger enter the functions too?
breakpoint
(red circle) exactly on the line the function main
is defined;F8
(the same as clicking Debug->Start/Continue
), which would make the program just run until the last line and exit (only flashing on the screen before disappearing), press Shift+F7
(the same as clicking Debug->Step Into
), in order to make the debugger enter the function and not just run it completely and return its result;F7
(the same as clicking Debug->Next line
) to keep watching the program run "step-by-step";Reference: ImageCraft - CodeBlocks Debugger Functions.
Source Line Stepping
Once paused, you can continue execution:
- Debug->Start/Continue runs the program until the next breakpoint.
- Debug->next line runs the program until the next source line. If the current source line contains a function call, it will “step over” the function call.
- Debug->Step into will “step into” a function call, and pause at the next source line.
- Debug->Step out will continue program execution until the function call returns to its caller.
- Debug->Next instruction and Debug->Step into instruction are assembly debugging commands, and should not be used within the CodeBlocks IDE. Instead, the corresponding commands in the ADT should be used.