Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get sizeof (type) in Windbg

Tags:

windbg

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.

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

like image 245
vlg789 Avatar asked Nov 29 '11 11:11

vlg789


1 Answers

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
like image 144
Kjell Gunnar Avatar answered Oct 08 '22 17:10

Kjell Gunnar