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

How to output partial of the result !da address with windbg?

如果数组包含 100000000 项,输出所有项就太长了所以我想知道我是否只想用 windbg 输出数组的十项,例如 !da top 10地址,如何处理?

!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. The !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