2012-12-14 7 views
7

코어 덤프가 있고 gdb로 코어 덤프를보고 있습니다.gdb로 유형을 알고있는 경우 boost :: any 값을 어떻게 볼 수 있습니까?

나는 boost :: gdb의 모든 값을 검사 할 수있는 방법이 있는지 궁금합니다.

코어에서 필자는 boost에 대한 주소를 가지고 있으므로 값을 검사 할 수 있는지 알아보기 위해 자리 표시 자로 캐스팅을 시도했지만 부족했습니다. 어떤 종류의 값을 보려고하는 방법이 있습니까?

(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

부스트를 보았습니까? 부스트 any에는 올바르게 기억 될 경우, 보유한 유형에 템플릿이 적용된 홀더에 대한 포인터가 포함됩니다. boost 자체는 동적 유형이 아니며 동적 유형을 소유합니다. – Yakk

+1

'boost :: any'에 gdb 예쁜 프린터를 쓸 수 있을지 궁금합니다. 결국, 보유한 타입의 'vtable' 포인터는 내용 유형이 무엇인지 알기 때문에 내용 유형을 알 필요조차 없습니다. 우리는 더 많은 gdb 예쁜 프린터가 필요합니다! – enobayram

답변

1

boost::any에는 데이터 내용을 보유하는 내부 클래스 placeholder이 있습니다. 사용해보기 :

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