@@ -47,6 +47,8 @@ pub enum WaitStatus {
47
47
Stopped ( Pid , Signal ) ,
48
48
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
49
49
PtraceEvent ( Pid , Signal , c_int ) ,
50
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
51
+ PtraceSyscall ( Pid ) ,
50
52
Continued ( Pid ) ,
51
53
StillAlive
52
54
}
@@ -56,6 +58,7 @@ pub enum WaitStatus {
56
58
mod status {
57
59
use sys:: signal:: Signal ;
58
60
use libc:: c_int;
61
+ use libc:: SIGTRAP ;
59
62
60
63
pub fn exited ( status : i32 ) -> bool {
61
64
( status & 0x7F ) == 0
@@ -88,6 +91,9 @@ mod status {
88
91
pub fn stop_additional ( status : i32 ) -> c_int {
89
92
( status >> 16 ) as c_int
90
93
}
94
+ pub fn syscall_stop ( status : i32 ) -> bool {
95
+ ( ( status & 0xFF00 ) >> 8 ) == SIGTRAP | 0x80
96
+ }
91
97
92
98
pub fn continued ( status : i32 ) -> bool {
93
99
status == 0xFFFF
@@ -145,6 +151,7 @@ mod status {
145
151
target_os = "netbsd" ) ) ]
146
152
mod status {
147
153
use sys:: signal:: Signal ;
154
+ use libc:: SIGTRAP ;
148
155
149
156
const WCOREFLAG : i32 = 0x80 ;
150
157
const WSTOPPED : i32 = 0x7f ;
@@ -196,7 +203,9 @@ fn decode(pid : Pid, status: i32) -> WaitStatus {
196
203
if #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ] {
197
204
fn decode_stopped( pid: Pid , status: i32 ) -> WaitStatus {
198
205
let status_additional = status:: stop_additional( status) ;
199
- if status_additional == 0 {
206
+ if status:: syscall_stop( status) {
207
+ WaitStatus :: PtraceSyscall ( pid)
208
+ } else if status_additional == 0 {
200
209
WaitStatus :: Stopped ( pid, status:: stop_signal( status) )
201
210
} else {
202
211
WaitStatus :: PtraceEvent ( pid, status:: stop_signal( status) , status:: stop_additional( status) )
0 commit comments