如果我知道带有gdb的类型,我怎么能看到boost :: any的值

时间:2012-12-14 20:42:57

标签: c++ boost gdb backtrace boost-any

我有一个核心转储,我正在使用gdb查看核心转储。

我想知道是否有办法能够检查gdb中boost :: any值的值?

在核心,我有地址提升任何,所以我尝试将它投射到占位符,看看我是否可以检查价值,但我做不到。我知道boost的类型是unsigned long,所以有没有办法查看知道类型的任何值?

(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
}

对此事的任何帮助将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:1)

boost::any有一个内部类placeholder,用于保存数据内容。尝试使用:

(gdb) print (*((boost::any::holder<unsigned long>*)((anyInstance).content))).held