I need to check where destructor of some specific object is called from. Let's say it is std::string at 0x9b993e4. I tried to execute following:
b std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string if (this==0x9b993e4)
But GDB says "No symbol "this" in current context." I also tried
b std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string if (std::basic_string<char, std::char_traits<char>, std::allocator<char> >::this==0x9b993e4)
GDB looks like set breakpoint, but when I run, it stops and writes
Error in testing breakpoint condition:
There is no field named this
Can anyone tell me how to break in destructor of specific object?
Thanks in advance!
I could not find any better way than use registers. So, on x86 you can check EAX, on ARM, probably, R0.
b ClassName::~ClassName if ($eax==<object_address>)
This solution doesn't work for some global static objects in my case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With