我正在使用帶SoS擴展名的WinDbg調試來自生產服務器的hangdump。WinDbg和SoS,如何打印/轉儲大字符串?
在其中一個堆棧中有一個字符串參數,我需要知道它的值。但是,它是一個相當大的字符串,並且當我使用DumpObj
時,WinDbg將不打印它。這是DumpObj
的輸出:
0:036> !do 00000001b30d8668
Name: System.String
MethodTable: 0000064278436728
EEClass: 000006427803e520
Size: 5125300(0x4e34b4) bytes
(C:\WINDOWS\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
String: <String is invalid or too large to print>
Fields:
MT Field Offset Type VT Attr Value Name
000006427843d998 4000096 8 System.Int32 1 instance 2562638 m_arrayLength
000006427843d998 4000097 c System.Int32 1 instance 2562637 m_stringLength
0000064278438170 4000098 10 System.Char 1 instance 3c m_firstChar
0000064278436728 4000099 20 System.String 0 shared static Empty
>> Domain:Value 0000000000163260:000000007fff0370 00000000001a6760:000000007fff0370 <<
0000064278438020 400009a 28 System.Char[] 0 shared static WhitespaceChars
>> Domain:Value 0000000000163260:000000007fff0b60 00000000001a6760:000000007fff89f0 <<
如何獲取此字符串實例的值?最好轉儲到文件。
如果字符串非常長,由於限制,起始地址/結束地址語法將不起作用。你需要使用du
L? <以字節爲單位的長度>。 對於真正長的字符串,這實際上會花費太長時間,WinDbg沒有再響應。 – 2013-12-11 12:10:39我在日誌中收到與命令窗口中相同的消息:<字符串無效或太大而無法打印> – 2015-04-17 20:35:40
我不明白。你會輸入什麼命令? – 2016-03-05 12:16:31