首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么!windbg中的dumpvc可以转储出数组元素?

为什么!windbg中的dumpvc可以转储出数组元素?
EN

Stack Overflow用户
提问于 2013-12-12 20:18:51
回答 1查看 1.7K关注 0票数 4

Dumping the contents of a dictionary object using Windbg and SOS.dll在此博客上,此命令如下:

代码语言:javascript
运行
复制
0:009> !dumpvc 000007fe984b57d8 000000018003ead8

他想查看数组中的一个元素,这里的元素类型是

代码语言:javascript
运行
复制
System.Collections.Generic.Dictionary`2+Entry[[System.Guid, mscorlib],[Microsoft.TeamFoundation.Framework.Server.TeamFoundationPerformanceCounters, Microsoft.TeamFoundation.Framework.Server]]

从我的角度来看,我认为!dumpvc用于探索值类型,即'Dictionary`2+Entry...‘类型。不是值类型。

造成这种情况的原因是什么?

我尝试过这个:转储一个字节数组。

代码语言:javascript
运行
复制
0:000> !da -length 3  -nofields 00000001ba9f63b0
-nofields has no effect unless -details is specified
Name:        System.Byte[]
MethodTable: 000007fee3a20b50
EEClass:     000007fee35a2330
Size:        148(0x94) bytes
Array:       Rank 1, Number of elements 124, Type Byte
Element Methodtable: 000007fee3a1c168
[0] 00000001ba9f63c0
[1] 00000001ba9f63c1
[2] 00000001ba9f63c2

0:000> !do 00000001ba9f63c0
<Note: this object has an invalid CLASS field>
0:000> !dumpvc 000007fee3a1c168 00000001ba9f63c0
Name:        System.Byte
MethodTable: 000007fee3a1c168
EEClass:     000007fee35a03b8
Size:        24(0x18) bytes
File:        C:\Windows\Microsoft.Net\assembly\....\mscorlib.dll
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
000007fee3a1c168  4000276        0          System.Byte  1 instance               62 m_value

它显示了我所期望的结果。在我调试的时候!dumpvc可以在任何地方探索数组元素吗?

EN

回答 1

Stack Overflow用户

发布于 2013-12-27 04:08:03

Byte[]是一种引用类型,您可以使用!do转储它。

Byte是一种值类型,如果有很多字节,可以使用!da转储它。

同样的道理也适用于字典:

字典2 is a reference type and dumped with!do`。

这些条目的类型为Dictionary2+Entry which seems to be a struct containing pointers to key and value (something like [KeyValuePair](http://msdn.microsoft.com/en-us/library/vstudio/5tbh8a42%28v=vs.80%29.aspx)). Structs are value types, dumped by!daand you can use!dumpvc`。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20543379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档