Reputation: 2049
I have a core dump and I am looking at the core dump with gdb.
I was wondering if there is a way to be able to examine the value of a boost::any value in gdb?
In the core, I had the address to the boost any and so I tried casting it to a placeholder to see if I could examine the value, but I fell short. I know that the type of the boost any is unsigned long so is there a way to view the any value knowing the type?
(gdb) print ('boost::any::placeholder')(*(('boost::any'*)0x00007f263fa27730).content)
warning: can't find linker symbol for virtual table for `boost::any::placeholder' value
warning: found `boost::any::holder<bool>::~holder()' instead
$129 = warning: can't find linker symbol for virtual table for `boost::any::placeholder' value
warning: found `boost::any::holder<bool>::~holder()' instead
warning: can't find linker symbol for virtual table for `boost::any::placeholder' value
warning: found `boost::any::holder<bool>::~holder()' instead
{
_vptr.placeholder = 0x7f2a9a662560
}
Any help with this matter would be much appreciated. Thanks!
Upvotes: 8
Views: 1033
Reputation: 2644
boost::any
has an internal class placeholder
which holds the data content. Try using:
(gdb) print (*((boost::any::holder<unsigned long>*)((anyInstance).content))).held
Upvotes: 1