2011-11-29 34 views
13

我需要一個變量的大小,並且我想從Windbg命令行獲得該值。 編譯代碼並添加C++ sizeof()僅用於獲取該值很困難且毫無用處。在Windbg中獲取sizeof(type)

從文檔中我看到Windbg可以在值dt /s之後過濾。但顯示該值?

回答

18

我對數據類型使用dt命令,然後很容易看到佈局和大小。

0:000> dt CRect 
CrashTestD!CRect 
    +0x000 left    : Int4B 
    +0x004 top    : Int4B 
    +0x008 right   : Int4B 
    +0x00c bottom   : Int4B 
0:000> dt long 
Int4B 

或者使用C++評估

0:000> ?? sizeof(CRect) 
unsigned int 0x10 
0:000> ?? sizeof(Float) 
unsigned int 4 
+1

+1的C++評估! – Vargas

相關問題