File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
tools/swift-inspect/Sources/SwiftInspectLinux Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -33,24 +33,25 @@ public struct PTrace: ~Copyable {
3333 // process by calling cont().
3434 // NOTE: clients must use withPTracedProcess instead of direct initialization.
3535 fileprivate init ( _ pid: pid_t ) throws {
36- guard ptrace_attach ( pid) != - 1 else {
37- throw PTraceError . operationFailure ( PTRACE_ATTACH, pid: pid)
36+ self . pid = pid
37+
38+ guard ptrace_attach ( self . pid) != - 1 else {
39+ throw PTraceError . operationFailure ( PTRACE_ATTACH, pid: self . pid)
3840 }
3941
4042 while true {
4143 var status : CInt = 0
42- let result = waitpid ( pid, & status, 0 )
44+ let result = waitpid ( self . pid, & status, 0 )
4345 if result == - 1 {
4446 if get_errno ( ) == EINTR { continue }
45- throw PTraceError . waitFailure ( pid: pid)
47+ throw PTraceError . waitFailure ( pid: self . pid)
4648 }
4749
48- precondition ( pid == result, " waitpid returned unexpected value \( result) " )
50+ precondition ( self . pid == result,
51+ " waitpid returned unexpected value \( result) " )
4952
5053 if wIfStopped ( status) { break }
5154 }
52-
53- self . pid = pid
5455 }
5556
5657 deinit { _ = ptrace_detach ( self . pid) }
You can’t perform that action at this time.
0 commit comments