在Windbg中获取sizeof(类型)

vlg*_*789 17 windbg

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

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

Kje*_*nar 23

我在数据类型上使用dt命令,然后很容易看到布局和大小.

0:000> dt CRect
 CrashTestD!CRect
   +0x000 left             : Int4B
   +0x004 top              : Int4B
   +0x008 right            : Int4B
   +0x00c bottom           : Int4B
0:000> dt long
Int4B
Run Code Online (Sandbox Code Playgroud)

或者使用C++评估程序

0:000> ?? sizeof(CRect) 
unsigned int 0x10
0:000> ??  sizeof(Float)
unsigned int 4
Run Code Online (Sandbox Code Playgroud)