Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a breakpoint on a member function called on a specific object

Tags:

c++

debugging

gdb

In gdb, is it possible to set a breakpoint on a member function called on a specific object? To be more specific, imagine class A has a member function Foo(). I'd like the program to stop when Foo is called on a specific object of type A (0xFF11DEADBEAF for example).

Is this at all possible?

like image 555
static_rtti Avatar asked Feb 09 '10 16:02

static_rtti


1 Answers

Use: b <Classname>::<functionname> if this==0xDEADBEEF (btw: all instances share member function addresses.)

like image 67
dirkgently Avatar answered Sep 22 '22 04:09

dirkgently