如何在函数返回时放置断点

时间:2021-11-28 19:55:12

I know the function name which is called. But not from where it is called. I want to put a breakpoint using gdb at return of this function. How to proceed?

我知道调用的函数名称。但不是从它被称为的地方。我想在返回此函数时使用gdb设置断点。如何进行?

Is there any specific command, or some series of steps?

是否有任何特定命令或一系列步骤?

2 个解决方案

#1


0  

You can use reverse debugging using this one:

您可以使用以下方法进行反向调试:

(gdb) fin
(gdb) reverse-step

#2


0  

If you are merely want to know what parent function called your specific function, put a breakpoint at the top of the child function in question. Once it breaks, use backtrace (or just bt) to see a full trace of the calls made to get to that point in execution.

如果您只是想知道哪个父函数称为您的特定函数,请在相关子函数的顶部放置一个断点。一旦它中断,使用backtrace(或者只是bt)来查看执行中到达该点的调用的完整跟踪。

#1


0  

You can use reverse debugging using this one:

您可以使用以下方法进行反向调试:

(gdb) fin
(gdb) reverse-step

#2


0  

If you are merely want to know what parent function called your specific function, put a breakpoint at the top of the child function in question. Once it breaks, use backtrace (or just bt) to see a full trace of the calls made to get to that point in execution.

如果您只是想知道哪个父函数称为您的特定函数,请在相关子函数的顶部放置一个断点。一旦它中断,使用backtrace(或者只是bt)来查看执行中到达该点的调用的完整跟踪。