Naveen's Blog

Software dev interested in .NET, windbg and anything on the way

dumpstring – windbg

with 4 comments

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(0×20) bytes
String:     Foo
Fields:
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 "%mu \n", c+

0:000> !ds 00000000025f2280

Foo

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

About these ads

Written by Naveen

June 29, 2010 at 9:55 pm

Posted in Windbg

4 Responses

Subscribe to comments with RSS.

  1. dumpstring – windbg…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

    DotNetShoutout

    June 30, 2010 at 12:35 pm

  2. Your site is excelent.
    Thanks.

    Tal

    January 26, 2011 at 7:10 am

  3. Thanks a lot even i was looking for the same

    Lavanya

    November 10, 2012 at 11:05 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: