【问题标题】:Get sizeof (type) in Windbg在 Windbg 中获取 sizeof (type)
【发布时间】:2012-01-08 17:54:15
【问题描述】:

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

从文档中我看到 Windbg 可以过滤值 dt /s。但显示该值?

【问题讨论】:

    标签: windbg


    【解决方案1】:

    我对数据类型使用 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
    

    【讨论】:

    • dt -v 标志提供更详细的输出,包括结构的总大小
    猜你喜欢
    • 2012-10-21
    • 1970-01-01
    • 2016-01-12
    • 2019-10-18
    • 1970-01-01
    • 1970-01-01
    • 2020-02-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多