使用GDB退出当前功能


Step out of current function with GDB

使用Visual Studio的用户将熟悉Shift + F11热键,该键会退出某个函数,这意味着它将继续执行当前函数,直到返回到调用者为止,然后停止。

GDB中是否有等效功能?


您可以使用finish命令。

finish: Continue running until just after function in the selected stack frame returns. Print the returned value (if any). This command can be abbreviated as fin.

(请参阅https://sourceware.org/gdb/current/onlinedocs/gdb/Continuing-and-Stepping.html#Continuing-and-Stepping)