如何用windbg输出部分结果!da地址?

问题描述 投票:0回答:1

如果数组包含100000000个item,那么输出所有items就太长了,请问我是否只想用windbg输出数组中的10个item,比如!da top 10地址,如何处理它 ?

debugging windbg sos
1个回答
5
投票

!da
命令采用
-start
-length
参数:

 -start <startIndex>: optional, only supported for single dimension array. 
                      Specify from which index the command shows the elements.
 -length <length>:    optional, only supported for single dimension array. 
                      Specify how many elements to show.

中,您可以将

!mdt
-start:
-count:
参数一起使用:

!sosex.mdt [typename | paramname | localname | MT] [ADDR] 
           [-r[:level]] [-e[:level]] [-start:index] [-count:n]

或者您可以使用NetExt

!wdo
命令适用于数组,并具有
/start
/end
参数来限制索引:

!wdo [/forcearray] [/shownull] [/noheader] [/noindex] [/mt <expr>]
     [/start <expr>] [/end <expr>] <expr>
  /mt <expr> - mt,Method table for value objects (space-delimited)
  <expr> - Address,Object Address
  /start <expr> - Starting index to show in an array (space-delimited)
  /end <expr> - Ending index to show in an array (space-delimited)
  /forcearray - For Byte[] and Char[] arrays show items not the string
  /shownull - For arrays will show items that are null
  /noheader - Display only object address and field and values
  /noindex - For arrays it will show values without the index
  /tokens - show class and type tokens for fields
© www.soinside.com 2019 - 2024. All rights reserved.