@@ -70,7 +70,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
70
70
var regionCount = 0
71
71
var allocCount = 0
72
72
do {
73
- try PTrace . withAttachedProcess ( pid: self . processIdentifier) { ptrace in
73
+ try withPTracedProcess ( pid: self . processIdentifier) { ptrace in
74
74
for entry in self . memoryMap. entries {
75
75
// Limiting malloc_iterate calls to only memory regions that are known
76
76
// to contain heap allocations is not strictly necessary but it does
@@ -105,7 +105,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
105
105
106
106
// Iterate a single heap region in the remote process and return an array
107
107
// 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 -> [ (
109
109
base: swift_addr_t , len: UInt64
110
110
) ] {
111
111
// Allocate a page-sized buffer in the remote process that malloc_iterate
@@ -158,7 +158,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
158
158
159
159
let regionLen = region. endAddr - region. startAddr
160
160
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
162
162
// This callback is invoked when a SIGTRAP is encountered in the remote
163
163
// process. In this context, this signal indicates there is no more room
164
164
// in the allocated metadata region (see AndroidCLib/heap.c).
@@ -208,7 +208,9 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
208
208
}
209
209
210
210
// 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
+ {
212
214
guard let sym = self . mmapSymbol. addr else {
213
215
throw RemoteProcessError . missingSymbol ( self . mmapSymbol. name)
214
216
}
@@ -217,7 +219,7 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
217
219
}
218
220
219
221
// 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 {
221
223
guard let sym = self . munmapSymbol. addr else {
222
224
throw RemoteProcessError . missingSymbol ( self . munmapSymbol. name)
223
225
}
@@ -226,15 +228,15 @@ internal final class AndroidRemoteProcess: LinuxRemoteProcess {
226
228
}
227
229
228
230
// call malloc_disable in the remote process
229
- internal func mallocDisableRemote( _ ptrace: PTrace ) throws {
231
+ internal func mallocDisableRemote( _ ptrace: borrowing PTrace ) throws {
230
232
guard let sym = self . mallocDisableSymbol. addr else {
231
233
throw RemoteProcessError . missingSymbol ( self . mallocDisableSymbol. name)
232
234
}
233
235
_ = try ptrace. jump ( to: sym)
234
236
}
235
237
236
238
// call malloc_enable in the remote process
237
- internal func mallocEnableRemote( _ ptrace: PTrace ) throws {
239
+ internal func mallocEnableRemote( _ ptrace: borrowing PTrace ) throws {
238
240
guard let sym = self . mallocEnableSymbol. addr else {
239
241
throw RemoteProcessError . missingSymbol ( self . mallocEnableSymbol. name)
240
242
}
0 commit comments