1111//===----------------------------------------------------------------------===//
1212
1313#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
14+ import ArgumentParser
15+ import SwiftRemoteMirror
1416
1517internal struct DumpArrays : ParsableCommand {
1618 static let configuration = CommandConfiguration (
@@ -23,14 +25,20 @@ internal struct DumpArrays: ParsableCommand {
2325 try inspect ( process: options. nameOrPid) { process in
2426 print ( " Address " , " Size " , " Count " , " Is Class " , separator: " \t " )
2527 process. iterateHeap { ( allocation, size) in
26- let metadata : swift_reflectioN_ptr_t =
28+ let metadata : UInt =
2729 swift_reflection_metadataForObject ( process. context, UInt ( allocation) )
2830 if metadata == 0 { return }
29- guard process. context. isContiguousArray ( metadata: metadata) else { return }
31+ guard process. context. isContiguousArray ( swift_reflection_ptr_t ( metadata) ) else {
32+ return
33+ }
3034
31- let isClass = process. context. isArrayOfClass ( metdata)
35+ let ReadBytes : RemoteProcess . ReadBytesFunction =
36+ type ( of: process) . ReadBytes
37+ let this = process. toOpaqueRef ( )
38+
39+ let isClass = process. context. isArrayOfClass ( swift_reflection_ptr_t ( metadata) )
3240 let count = process. context. arrayCount ( swift_reflection_ptr_t ( allocation) ,
33- process . ReadBytes)
41+ { ReadBytes ( this , $0 , UInt64 ( $1 ) , nil ) } )
3442 print ( " \( hex: swift_reflection_ptr_t ( allocation) ) \t \( size) \t \( count. map ( String . init) ?? " <unknown> " ) \t \( isClass) " )
3543 }
3644 }
0 commit comments