I am analyzing a crash dump with WinDbg and SOS (How to debug System.ExecutionEngineException in a framework code of a managed application).
I am able to list objects of certain type on managed heap: String
!DumpHeap -mt 7239afb0 -min 50
I can look at the class:
!DumpObj 0x0a7be6a4
Name: System.String
...
File: C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: C:\Program Files (x86)\XSLStylesheets
Fields:
MT Field Offset Type VT Attr Value Name
7239c770 40000aa 4 System.Int32 1 instance 74 m_stringLength
7239b9a8 40000ab 8 System.Char 1 instance 43 m_firstChar
7239afb0 40000ac c System.String 0 shared static Empty
And now How to read a string value? and How to access a string when it is a field of a class?
Fields:
MT Field Offset Type VT Attr Value Name
...
7239afb0 4000719 c System.String 0 instance 01182390 m_Name
Edit
Because I get the answer after asking in a comment, I put an explanation here. To get string value just use !do address
or !do -nofields address
(!do =!DumpObj). In the result is the line starting "String:" and this line contains the desired value (in my case it contained a path and I did not believed to be a right value).
To access an object which is a field of another object we use the value from the column Value
as an address for !do. So for the field m_Name from example we run !do 0x01182390
.
!do
gives you the string value as part of the object dump. If you want to see the string fields of an object, then you need to run !do
on the field value. !sosex.mdt
is a bit more efficient in this regard, as it will list the string values next to string fields.