Get sizeof (type) in Windbg

前端 未结 1 810
忘掉有多难
忘掉有多难 2021-02-18 23:06

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.

1条回答
  •  走了就别回头了
    2021-02-18 23:17

    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
    

    Or use the C++ evaluator

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

    0 讨论(0)
提交回复
热议问题