在 Windbg 中获取 sizeof (type) [英] Get sizeof (type) in Windbg

查看:20
本文介绍了在 Windbg 中获取 sizeof (type)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need the size of a variable and I want that value from Windbg command line. It's hard and useless to compile the code and add a C++ sizeof() only to get that value.

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

From documentation I see that Windbg can filter after value dt /s. but displayng that value ?

推荐答案

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

I use the dt command on the data type and then it’s easy see the layout and size.

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

或者使用 C++ 评估器

Or use the C++ evaluator

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

这篇关于在 Windbg 中获取 sizeof (type)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆