的WinDbg和SOS,我该怎么办打印/倾倒了大量的字符串? [英] WinDbg and SoS, how do I print/dump a large string?

查看:356
本文介绍了的WinDbg和SOS,我该怎么办打印/倾倒了大量的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试一个hangdump使用的WinDbg与SOS扩展生产服务器来了。

I am debugging a hangdump coming from a production server using WinDbg with the SoS extension.

有一个在栈中的一个字符串参数,我需要知道的价值。然而,这是一个相当大的字符串,当我使用 DumpObj 的WinDbg不会打印。这是从输出 DumpObj

There is a string parameter in one of the stacks, that I need to know the value of. However, it is a rather large string, and WinDbg won't print it when I am using DumpObj. This is the output from 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 <<

我如何能得到这个字符串实例的价值? preferably转储到一个文件中。

How can I get the value of this string instance ? Preferably dumped to a file.

推荐答案

我会三思而后行倾销2562638人物值得文本之前,但如果你真的想,该文本存储后的字符串实例的领域,所以你可以做一个杜&LT;地址+偏移&GT; &LT;结束地址&gt; 转储字符串的实际文本。输出会是这个样子:

I would think twice before dumping 2562638 characters worth of text, but if you really want to, the text is stored following the fields of the string instance, so you can do a du <address+offset> <end address> to dump the actual text of the string. The output will look something like this:

00000000`132ab050  "this is an extremely long string"
00000000`132ab090  " of text, so don't even bother t"
00000000`132ab0d0  "o try to dump it to the screen -"

通过登录会话输出到文件,您可以轻松地捕获输出,做任何后期处理需要。

By logging the session output to a file, you can easily capture the output and do whatever post-processing you need.

这篇关于的WinDbg和SOS,我该怎么办打印/倾倒了大量的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆