How can I access target of a std::tr1::shared_ptr in GDB. This doesn't work:
(gdb) p sharedPtr->variableOfTarget
If I try with the pointer object itself (p sharedPtr
) I get something like this:
$1 = std::tr1::shared_ptr (count 2) 0x13c2060
With a normal pointer I can do p *ptr
and get all the data or p ptr->variable
for just one variable.
I'm on Centos 6.5, GCC 4.4.7-4.el6 and GDB 7.2-64.el6_5.2.
(gdb) p sharedPtr.get()
? – Tomskp (*sharedPtr.get())
prints contents of the target object andp (*sharedPtr.get())->variableOfTarget
will print a single variable. Funny thing is though that if you leave out the parentheses like thisp *sharedPtr.get()
it will also advance execution of the program. Can someone explain why is that? – Collazounique_ptr
: #22799101 – Appertain