xref: /drstd/dlibc/src/unix/header/sys_ptrace/mod.rs (revision b38c79420b3f9b2af3cf74b30d9faaadb20eb8b0)
1 //! ptrace compatibility layer for Redox OS
2 
3 use core::ffi::VaList;
4 use crate::unix::platform;
5 
6 pub const PTRACE_TRACEME: ::c_int = 0;
7 pub const PTRACE_PEEKTEXT: ::c_int = 1;
8 pub const PTRACE_PEEKDATA: ::c_int = 2;
9 pub const PTRACE_POKETEXT: ::c_int = 4;
10 pub const PTRACE_POKEDATA: ::c_int = 5;
11 pub const PTRACE_CONT: ::c_int = 7;
12 pub const PTRACE_KILL: ::c_int = 8;
13 pub const PTRACE_SINGLESTEP: ::c_int = 9;
14 pub const PTRACE_GETREGS: ::c_int = 12;
15 pub const PTRACE_SETREGS: ::c_int = 13;
16 pub const PTRACE_GETFPREGS: ::c_int = 14;
17 pub const PTRACE_SETFPREGS: ::c_int = 15;
18 pub const PTRACE_ATTACH: ::c_int = 16;
19 pub const PTRACE_DETACH: ::c_int = 17;
20 pub const PTRACE_SYSCALL: ::c_int = 24;
21 pub const PTRACE_SYSEMU: ::c_int = 31;
22 pub const PTRACE_SYSEMU_SINGLESTEP: ::c_int = 32;
23 
24 // Can't use "params: ..." syntax, because... guess what? Cbingen again :(
25 #[no_mangle]
26 pub unsafe extern "C" fn sys_ptrace(request: ::c_int, _params: VaList) -> ::c_int {
27     // Musl also just grabs the arguments from the varargs...
28     //
29     //platform::pal::ptrace(request, params.arg(), params.arg(), params.arg()) as ::c_int
30     platform::pal::ptrace(request) as ::c_int
31 }
32