代码之家  ›  专栏  ›  技术社区  ›  Lasse V. Karlsen

windbg,如何查看数组的内容?

  •  21
  • Lasse V. Karlsen  · 技术社区  · 15 年前

    我正在使用windbg分析一个程序的转储文件,该程序内存使用率太高。

    其中一个涉及的对象是持有一个对象数组,引用许多我想查看的对象,试图找出它们被分配的原因。

    以下是我的尝试:

    首先,我的ServiceContainer对象集合:

    0:000> !do 05633014 
    Name: System.Collections.Generic.List`1[[LVK.IoC.ServiceContainer, LVK.Core]]
    MethodTable: 08b3c7fc
    EEClass: 6f70ca78
    Size: 24(0x18) bytes
     (C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
    Fields:
          MT    Field   Offset                 Type VT     Attr    Value Name
    6f924324  40009d8        4      System.Object[]  0 instance 1da226ec _items
    6f952da0  40009d9        c         System.Int32  1 instance     5356 _size
    6f952da0  40009da       10         System.Int32  1 instance     5538 _version
    6f950770  40009db        8        System.Object  0 instance 00000000 _syncRoot
    6f924324  40009dc        0      System.Object[]  0   shared   static _emptyArray
        >> Domain:Value dynamic statics NYI
     002b2a28:NotInit  <<
    

    这个 _items array有一个我要查看的,所以我发出了以下命令:

    0:000> !do 1da226ec
    

    产生:

    Name: System.Object[]
    MethodTable: 6f924324
    EEClass: 6f70da64
    Size: 32784(0x8010) bytes
    Array: Rank 1, Number of elements 8192, Type CLASS
    Element Type: LVK.IoC.ServiceContainer
    Fields:
    None
    

    看看网络,我发现 indications 有一个 -v 选项我可以用它来生成数组值,但这似乎不起作用。

    如何查看此数组的元素?

    1 回复  |  直到 15 年前
        1
  •  27
  •   SamuelWarren    15 年前

    你在找

    !da 1da226ec
    

    转储数组对象。