The pop Command

The pop command removes one or more call frames from the call stack:

DBX Mode

 

pop_stack_frame_command

        : pop [expression]

 

The default is one call frame. The pop command undoes the work already done by the removed execution frames. It does not, however, reverse side effects, such as changes to global variables.

Note:

Because it is extremely unlikely this will fix all the effects of a half-executed call, this command is not recommended for general use. Furthermore, the pop command does not provide a way to specify a return value when the frame being discarded corresponds to a function that should return a value. You may need to use the assign command to restore the values of global variables.

Instead of the pop command, you may want to use the return command, which finishes the call corresponding to the selected frame.

GDB Mode

 

pop_stack_frame_command

        : return [expression]

 

When you use return, the selected stack frame is discarded (and all frames within it). If you wish to specify a value to be returned, give that value as the argument to return.

The return command does not resume execution. It leaves the program stopped in the state that would exist if the function had just returned. In contrast, the finish command resumes execution until the selected stack frame returns naturally.