![](/img/trans.png)
[英]in a javascript object, what's best way to get the attribute of a value?
[英]What's the way to get only the property value of an object using Windbg?
我正在使用 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
),我可以解析結果以獲得它,但是由於我有很多對象(大約 100,000 個),這變得非常耗時,因此我想盡可能限制結果。
有沒有辦法(使用其他顯示選項,使用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.
現在我只需要找到一種不再看到內存地址的方法。
為什么不想使用 pykd 中的 typedVar 類?
嘗試:
print( typedVar('CStringArray', address).m_nSize )
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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.