开发者

GDB break on object function call

I'm debugging an issue, a开发者_开发百科nd I want to break on every method call that has a specific object as the 'this' parameter. Is this possible in GDB?


It's easy. You can use command like b A::a if (this==0x28ff1e).


The this parameter should only be the methods that are included in the class itself. So you should just need to set breakpoints for all Of the methods of the class you are looking at. I'm not sure there is a simple way to do that though.


I want to break on every method call that has a specific object as the 'this' parameter

This means that you want to break on every member function of a particular class for which the object has been instantiated.

Let's say for convenience that all the member functions are defined in a particular cpp file such as myclass_implementation.cpp

You can use gdb to apply breakpoint on every function inside myclass_implementation.cpp this way:

rbreak myclass_implementation.cpp:.

Let's say you want to break on some specific functions such as getter functions which start with Get, then you can use gdb to apply breakpoints this way:

rbreak myclass_implementation.cpp:Get*
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜