Step out
Step out is stepping out of the current function execution.
Interface
class debugger
{
public:
void step_out();
}
Interface explained
Again, deceptively simple interface. That's how debugger make a user's life easy, isn't it?
Implementation
We want to run after return, therefore we will naturally set a breakpoint at the return sites. When we hit the breakpoint, we step one more instruction further, if the stack pointer is larger than the time when we expect to step out, we are now outside of the frame, just step again until we reach another statement.
Practice notes
We are lucky because our code generator generates a single exit point, sometimes we do not. In that case we need to guard all the exit points.