調試時,我有一個地址進入內存並知道駐留在該地址的對象的類型,並且我希望調試器顯示該實例物體。這可以通過打印命令來完成,這些類型不是模板,但對於模板實例化的類型似乎失敗。使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)