0

by using command !dumpgen 2 -stat, I find that there are 3GB strings, 23,531,124 3,110,704,598 System.String, if I dump all of them, it will hang the windbg, is there any way I can only dump limited large object result in Gen 2 only? thus I can dump those objects and see what they are. SAME ASK for LOH. Thanks for help in advance.

Sky Line
  • 47
  • 1
  • 7
  • 1
    Well, you can dump a limited amount, but you foget to tell us what the limiting factor is. Are you looking for strings with a specific content? Strings with specific length? Strings referenced by a specific object? – Thomas Weller Feb 17 '18 at 16:24
  • Hello, Thomas, thanks for chime in, I want to control the output result count, either the ones whose size is greater than some specific number or top N largest one, I want to look into them and see what the content inside those strings. I hope the one I get is from Gen 2 only and LOH only respectively. Thanks for help. – Sky Line Feb 17 '18 at 17:19
  • 1
    To get a sample, I typically run the command, let it scroll several pages and then break. That usually gives you a good idea if there is a pattern, which there probably is with that many strings. – Steve Johnson Feb 18 '18 at 05:50
  • I am new to windbg sos/sosex, can you share the command to achieve this effect "scroll several pages and then break"? – Sky Line Feb 18 '18 at 17:05
  • sorry, can I get more speicifc operation commands? – Sky Line Feb 20 '18 at 17:22

1 Answers1

0

The text is stored inline with the instance of the String. You can use du to dump the Unicode characters from the instance. Here's an example. I have a very long string at address 03ec5528 that I have located using !dumpstat. Dumping this I get: (I have cut most of the string from the output) and you don't need to dump the object - it's just to illustrate what I'm using for the example.

0:000> !DumpObj 03ec5528
Name:        System.String
MethodTable: 7235d6d8
EEClass:     71f34a50
Size:        135808(0x21280) bytes
File:        C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String:      Lorem ipsum dolor sit amet, consectetur adipiscing elit. (I HAVE CUT MOST OF THE STRING FROM THE OUTPUT) 
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
7235f52c  4000275        4         System.Int32  1 instance    67897 m_stringLength
7235e120  4000276        8          System.Char  1 instance       4c m_firstChar
7235d6d8  400027a       54        System.String  0   shared   static Empty
    >> Domain:Value  00f25e58:NotInit  <<

To list the text use du with the base address plus the offset (+8 on 32 bit). Using the default output for du produces the text below. You can control the length output by providing a range for the command.

0:000> du 03ec5528+8
03ec5530  "Lorem ipsum dolor sit amet, cons"
03ec5570  "ectetur adipiscing elit. Integer"
03ec55b0  " in dapibus urna, sed lobortis o"
03ec55f0  "rci. Integer sapien nunc, rutrum"
03ec5630  " id libero sollicitudin, interdu"
03ec5670  "m ornare velit. Aenean porttitor"
03ec56b0  " convallis vulputate. Nunc at au"
03ec56f0  "gue a nibh finibus commodo. Morb"
03ec5730  "i volutpat eleifend nunc vel mat"
03ec5770  "tis. Mauris accumsan, est ac fri"
03ec57b0  "ngilla interdum, purus mi euismo"
03ec57f0  "d purus, ac dapibus massa dolor "

I hope that helps.

Brian Rasmussen
  • 114,645
  • 34
  • 221
  • 317