-1

我正在使用 PYKD 进行转储调试,因此我正在使用PYKD dbgCommand()获取有关对象的信息。

问题是:dbgCommand()需要解析结果才能使用,如以下示例所示:

source code : result = dbgCommand(("dt -c CStringArray m_nSize " + pointer_format) % (ptr)).split(' : ')
example     : dt -c CStringArray m_nSize 0x03966ce8
example output : 
  <application>!CStringArray
  +0x008 m_nSize 0n16  

我只对大小本身感兴趣0n16(尽可能限制结果。

有没有办法(使用其他显示选项,使用其他命令dt,如果需要,使用本机可视化器)来获得以下情况:

dt <options> CStringArray m_nSize 0x03966ce8
0n16 // only that, nothing else

与此同时,我已经使用命令更进一步dd,如您所见:

0:000> dd 0x03966ce8+0x008 L1 // for a CStringArray, m_nSize is at memory address +0x008
                              // L1 means: limit the amount of answers to one byte
03966cf0  00000010            // the result only contains one line.

现在我只需要找到一种不再看到内存地址的方法。

4

2 回答 2

2

为什么不想使用 pykd 中的 typedVar 类?

尝试:

print( typedVar('CStringArray', address).m_nSize )
于 2018-11-08T16:27:56.457 回答
0
0:000> dt -c foo m_nsize
Local var @ 0x2dfdb8 Type CStringArray
+0x008 m_nSize 0n5
0:000> .printf "%x\n" , @@c++(foo.m_nSize)
5
0:000>
于 2020-11-02T19:14:48.093 回答