@@ -70,7 +70,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
7070 var regionCount = 0
7171 var allocCount = 0
7272 do {
73- try PTrace . withAttachedProcess ( pid: self . processIdentifier) { ptrace in
73+ try withPTracedProcess ( pid: self . processIdentifier) { ptrace in
7474 for entry in self . memoryMap. entries {
7575 // Limiting malloc_iterate calls to only memory regions that are known
7676 // to contain heap allocations is not strictly necessary but it does
@@ -105,7 +105,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
105105
106106 // Iterate a single heap region in the remote process and return an array
107107 // of (base, len) pairs describing each heap allocation in the region.
108- internal func iterateHeapRegion( _ ptrace: PTrace , region: MemoryMap . Entry ) throws -> [ (
108+ internal func iterateHeapRegion( _ ptrace: borrowing PTrace , region: MemoryMap . Entry ) throws -> [ (
109109 base: swift_addr_t , len: UInt64
110110 ) ] {
111111 // Allocate a page-sized buffer in the remote process that malloc_iterate
@@ -158,7 +158,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
158158
159159 let regionLen = region. endAddr - region. startAddr
160160 let args = [ region. startAddr, regionLen, remoteCodeAddr, remoteDataAddr]
161- _ = try ptrace. jump ( to: mallocIterateAddr, with: args) {
161+ _ = try ptrace. jump ( to: mallocIterateAddr, with: args) { ptrace in
162162 // This callback is invoked when a SIGTRAP is encountered in the remote
163163 // process. In this context, this signal indicates there is no more room
164164 // in the allocated metadata region (see AndroidCLib/heap.c).
@@ -208,7 +208,9 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
208208 }
209209
210210 // call mmap in the remote process with the provided arguments
211- internal func mmapRemote( _ ptrace: PTrace , len: Int , prot: Int32 , flags: Int32 ) throws -> UInt64 {
211+ internal func mmapRemote( _ ptrace: borrowing PTrace , len: Int , prot: Int32 , flags: Int32 ) throws
212+ -> UInt64
213+ {
212214 guard let sym = self . mmapSymbol. addr else {
213215 throw RemoteProcessError . missingSymbol ( self . mmapSymbol. name)
214216 }
@@ -217,7 +219,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
217219 }
218220
219221 // call munmap in the remote process with the provdied arguments
220- internal func munmapRemote( _ ptrace: PTrace , addr: UInt64 , len: Int ) throws -> UInt64 {
222+ internal func munmapRemote( _ ptrace: borrowing PTrace , addr: UInt64 , len: Int ) throws -> UInt64 {
221223 guard let sym = self . munmapSymbol. addr else {
222224 throw RemoteProcessError . missingSymbol ( self . munmapSymbol. name)
223225 }
@@ -226,15 +228,15 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
226228 }
227229
228230 // call malloc_disable in the remote process
229- internal func mallocDisableRemote( _ ptrace: PTrace ) throws {
231+ internal func mallocDisableRemote( _ ptrace: borrowing PTrace ) throws {
230232 guard let sym = self . mallocDisableSymbol. addr else {
231233 throw RemoteProcessError . missingSymbol ( self . mallocDisableSymbol. name)
232234 }
233235 _ = try ptrace. jump ( to: sym)
234236 }
235237
236238 // call malloc_enable in the remote process
237- internal func mallocEnableRemote( _ ptrace: PTrace ) throws {
239+ internal func mallocEnableRemote( _ ptrace: borrowing PTrace ) throws {
238240 guard let sym = self . mallocEnableSymbol. addr else {
239241 throw RemoteProcessError . missingSymbol ( self . mallocEnableSymbol. name)
240242 }
0 commit comments