在Windbg中获取sizeof(类型)

时间:2011-11-29 11:28:10

标签: windbg

我需要变量的大小,我想从Windbg命令行获取该值。 编译代码并添加C ++ sizeof()只是为了获得该值,这很难也没用。

从文档中我看到Windbg可以在值dt /s之后进行过滤。但是显示那个值?

1 个答案:

答案 0 :(得分:21)

我在数据类型上使用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
相关问题