本文介绍了在Windbg中,如何从!do命令获取全部内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在处理.NET应用程序中的内存问题,我正在使用Windbg调试问题,我发现了内存问题是什么,但是在调查期间!do命令正在为我获取对象内容过大,但是该命令显示的内容被截断了,有没有办法我可以从!do命令完全获取其内容?

I'm currently working in a memory issue on a .NET application, I'm debugging the Issue using Windbg I have come across to what the memory issue is, but during the investigation !do command is getting me the object which has a content that is excessive large BUT the Content that gets displayed by the command is truncated, Is there a way that I can get the Content in its entirely from the !do command?

命令的结果如下所示:

0:000> !do [Address]
Name:        System.Byte[]
MethodTable: ...
EEClass:     ...
Size:        1048600(0x100018) bytes
Array:       Rank 1, Number of elements 1048576, Type Byte
Content:     [This is the content that its getting truncated]
Fields:
None

推荐答案

由于具有byte数组,因此可以使用db转储原始内存.我创建了一个值为0、1、2,... 2000的byte数组,并将其转储出去:

Since you have a byte array you can use db to dump out the raw memory. I created a byte array with values 0, 1, 2, ... 2000 and dumped it out:


0:000> !do 0x020a3560
Name:        System.Byte[]
MethodTable: 73504588
EEClass:     7319229c
Size:        2012(0x7dc) bytes
Array:       Rank 1, Number of elements 2000, Type Byte
Content:     ................................ !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~.
Fields:
None

0:000> db 0x020a3560 0x020a3560+07dc
020a3560  88 45 50 73 d0 07 00 00-00 01 02 03 04 05 06 07  .EPs............
020a3570  08 09 0a 0b 0c 0d 0e 0f-10 11 12 13 14 15 16 17  ................
020a3580  18 19 1a 1b 1c 1d 1e 1f-20 21 22 23 24 25 26 27  ........ !"#$%&'
020a3590  28 29 2a 2b 2c 2d 2e 2f-30 31 32 33 34 35 36 37  ()*+,-./01234567
020a35a0  38 39 3a 3b 3c 3d 3e 3f-40 41 42 43 44 45 46 47  89:;?@ABCDEFG
020a35b0  48 49 4a 4b 4c 4d 4e 4f-50 51 52 53 54 55 56 57  HIJKLMNOPQRSTUVW
020a35c0  58 59 5a 5b 5c 5d 5e 5f-60 61 62 63 64 65 66 67  XYZ[\]^_`abcdefg
020a35d0  68 69 6a 6b 6c 6d 6e 6f-70 71 72 73 74 75 76 77  hijklmnopqrstuvw
020a35e0  78 79 7a 7b 7c 7d 7e 7f-80 81 82 83 84 85 86 87  xyz{|}~.........
020a35f0  88 89 8a 8b 8c 8d 8e 8f-90 91 92 93 94 95 96 97  ................
...(snip)...

前4个字节是方法表(73504588),后4个字节是数组的长度(0x07D0或0n2000).那么之后的所有字节就是数据.

The first 4 bytes are the method table (73504588), and the next 4 bytes are the length of the array (0x07D0, or 0n2000). Then all the bytes after that are the data.

这篇关于在Windbg中,如何从!do命令获取全部内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 07:26