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

时间:2016-09-06 10:23:41

标签: debugging windbg sos

如果数组包含100000000项,则输出所有项目的时间太长,所以我可能知道是否只想用windbg输出数组的十个项目,例如!da 前10名地址,如何处理?

1 个答案:

答案 0 :(得分:4)

!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