dumpstring – windbg

Viewing strings inside the debugger has never been pretty, especially if you are using sos extension.  Here is a sample !dumpobj on a string

0:000> !do 00000000025f2280
Name:        System.String
MethodTable: 000007fef6e26960
EEClass:     000007fef69aeec8
Size:        32(0x20) bytes
String:     Foo
MT    Field   Offset                 Type VT     Attr            Value Name
000007fef6e2c848  40000ed        8         System.Int32  1 instance                3 m_stringLength
000007fef6e2b388  40000ee        c          System.Char  1 instance               46 m_firstChar
000007fef6e26960  40000ef       10        System.String  0   shared           static Empty
>> Domain:Value  00000000002ae900:00000000025e1420 <<

Some of the devs like to use the du command

du 00000000025f2280+c

0:000> du 00000000025f2280+c

00000000`025f228c  “Foo”

My choice is to use the .printf command and here is my alias for printing string

as !ds .printf &quot;%mu n&quot;, c+

0:000> !ds 00000000025f2280


I prefer .printf over du because I am not interested in looking at the memory address often especially dumping strings within a script.




4 thoughts on “dumpstring – windbg

  1. Pingback: DotNetShoutout

Leave a Reply

Your email address will not be published. Required fields are marked *