@@ -132,10 +132,10 @@ impl Iterator for ChildListener {
132132 return Some ( ExecEvent :: Syscall ( pid) ) ;
133133 } ,
134134 // Child with the given pid was stopped by the given signal.
135- // It's somewhat dubious when this is returned instead of
136- // WaitStatus::Stopped, but for our purposes they are the
137- // same thing.
138- wait:: WaitStatus :: PtraceEvent ( pid, signal, _) =>
135+ // It's somewhat unclear when which of these two is returned;
136+ // we just treat them the same.
137+ wait :: WaitStatus :: Stopped ( pid , signal )
138+ | wait:: WaitStatus :: PtraceEvent ( pid, signal, _) =>
139139 if self . attached {
140140 // This is our end-of-FFI signal!
141141 if signal == signal:: SIGUSR1 {
@@ -148,19 +148,6 @@ impl Iterator for ChildListener {
148148 // Just pass along the signal.
149149 ptrace:: cont ( pid, signal) . unwrap ( ) ;
150150 } ,
151- // Child was stopped at the given signal. Same logic as for
152- // WaitStatus::PtraceEvent.
153- wait:: WaitStatus :: Stopped ( pid, signal) =>
154- if self . attached {
155- if signal == signal:: SIGUSR1 {
156- self . attached = false ;
157- return Some ( ExecEvent :: End ) ;
158- } else {
159- return Some ( ExecEvent :: Status ( pid, signal) ) ;
160- }
161- } else {
162- ptrace:: cont ( pid, signal) . unwrap ( ) ;
163- } ,
164151 _ => ( ) ,
165152 } ,
166153 // This case should only trigger when all children died.
@@ -250,7 +237,7 @@ pub fn sv_loop(
250237 // We can't trust simply calling `Pid::this()` in the child process to give the right
251238 // PID for us, so we get it this way.
252239 curr_pid = wait_for_signal ( None , signal:: SIGSTOP , InitialCont :: No ) . unwrap ( ) ;
253-
240+ // Continue until next syscall.
254241 ptrace:: syscall ( curr_pid, None ) . unwrap ( ) ;
255242 }
256243 // Child wants to end tracing.
@@ -289,8 +276,7 @@ pub fn sv_loop(
289276 }
290277 }
291278 } ,
292- // Child entered a syscall; we wait for exits inside of this, so it
293- // should never trigger on return from a syscall we care about.
279+ // Child entered or exited a syscall. For now we ignore this and just continue.
294280 ExecEvent :: Syscall ( pid) => {
295281 ptrace:: syscall ( pid, None ) . unwrap ( ) ;
296282 }
@@ -344,8 +330,8 @@ fn wait_for_signal(
344330 return Err ( ExecEnd ( Some ( code) ) ) ;
345331 }
346332 wait:: WaitStatus :: Signaled ( _, _, _) => return Err ( ExecEnd ( None ) ) ,
347- wait:: WaitStatus :: Stopped ( pid, signal) => ( signal , pid ) ,
348- wait:: WaitStatus :: PtraceEvent ( pid, signal, _) => ( signal, pid) ,
333+ wait:: WaitStatus :: Stopped ( pid, signal)
334+ | wait:: WaitStatus :: PtraceEvent ( pid, signal, _) => ( signal, pid) ,
349335 // This covers PtraceSyscall and variants that are impossible with
350336 // the flags set (e.g. WaitStatus::StillAlive).
351337 _ => {
0 commit comments