Wednesday, July 21, 2010

WinDbg SOS Find Strings in .NET Application

Find all strings loaded in the .net process
!dumpheap -strings

Output for dumping all strings, the total size is the parameter for min and max
















Count Total Size String Value
1 20 "z"
1 20 "y"


Find all the string between specific sizes with and ----- between each listings

.foreach(loadedString {!dumpheap -type System.String -min 40 -max 50 -short}){!do -nofields loadedString;.echo -------------}

Make sure that the range is small as if its too large the windows debugger hangs.

Its better to use the previous command and find out the length of the string and then use the
!dumpheap -type System.String -min 40 -max 50 -short to get the address of these strings

Output for this would be
Name: System.String
MethodTable: 703588c0
EEClass: 7011a498
Size: 44(0x2c) bytes
(C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
String: eventMappings
----------------

since we have put -nofields we don't see the internal fields for String class. The "eventMappings" is the actual value present in the memory
P.S
The blanks are due to the editor not able to understand the table tag

2 comments:

  1. In the past, talking about Windows family software development has involved using of C with the Windows application programming interface (API). Although various types of applications have been created using this technology, using the API is a complex approach. The first problem is that C is a very laconic language.

    .Net Application Development

    ReplyDelete
  2. Highly efficient and large organizations preferred to develop their software development in .NET because they have less chances of bugs and errors to prevent heavy losses. On other side .NET is an open source platform that offer from Microsoft and used dynamic websites.

    ReplyDelete