디버깅 할 때 메모리에 주소가 있으며 그 주소에있는 객체의 유형을 알고 디버거에 해당 인스턴스를 표시하려고합니다. 그 물체. 템플릿이 아니지만 템플릿을 인스턴스화하는 유형의 경우 실패하는 것으로 보이는 유형의 인쇄 명령을 통해이 작업을 수행 할 수 있습니다. 전자는 실패, 내가 프로그램을 실행할 때LLDB가 주소 유형을 템플릿 인스턴스화 객체에 대한 포인터로 재 해석합니다.
template<typename T>
class X
{
public:
X() {
printf("a\n");
}
};
class Y
{
public:
Y() {
printf("a\n");
}
};
int main(void)
{
X<int> x;
Y y;
return 1;
}
는, 메인에 휴식 및 X와 Y 객체 모두에 대한 포인터로 임의 유효 주소를 해석하려고 :
이 예제 코드를 참조
(lldb) p *(Y*)0x0000000100000ee6
(Y) $0 = {}
(lldb) p *(X<int>*)0x0000000100000ee6
warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
error: use of undeclared identifier 'X'
error: expected '(' for function-style cast or type construction
error: expected expression
lldb에서 이것을 수행하는 방법이 있습니까? (편집 : Mac OS X lldb-360.1.65 및 lldb-310.2.37)