diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs index 306dd892af..48f69fa1cd 100644 --- a/src/sys/ptrace.rs +++ b/src/sys/ptrace.rs @@ -5,11 +5,14 @@ use ::unistd::Pid; //------------------ First part: a low-level wrapper for ptrace -----------------// +<<<<<<< HEAD #[cfg(all(target_os = "linux", any(target_arch = "x86", target_arch = "x86_64", target_arch = "arm")), )] +======= +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd pub mod ptrace { use libc::c_int; @@ -151,7 +154,11 @@ pub fn ptrace_setsiginfo(pid: Pid, sig: &siginfo_t) -> Result<()> { } } +<<<<<<< HEAD //-------------------------- Second part: a high-level wrapper for ptrace ----------------------// +======= +//-------------------------- Second part: a low-level wrapper for ptrace ----------------------// +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd #[cfg(target_arch = "x86_64")] // We're going to export it anyway @@ -187,15 +194,22 @@ pub enum Register { GS = 26 * 8, } +<<<<<<< HEAD type Word = usize; +======= +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd /// Makes the `PTRACE_SYSCALL` request to ptrace pub fn syscall(pid: Pid) -> Result<()> { ptrace(ptrace::PTRACE_SYSCALL, pid, ptr::null_mut(), ptr::null_mut()).map(|_| ()) // ignore the useless return value } /// Makes the `PTRACE_PEEKUSER` request to ptrace +<<<<<<< HEAD pub fn peekuser(pid: Pid, reg: Register) -> Result { +======= +pub fn peekuser(pid: Pid, reg: Register) -> Result { +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd let reg_arg = (reg as i32) as *mut c_void; ptrace(ptrace::PTRACE_PEEKUSER, pid, reg_arg, ptr::null_mut()) } @@ -214,7 +228,11 @@ pub fn traceme() -> Result<()> { /// /// This function allows to access arbitrary data in the traced process /// and may crash the inferior if used incorrectly and is thus marked `unsafe`. +<<<<<<< HEAD pub unsafe fn peekdata(pid: Pid, addr: usize) -> Result { +======= +pub unsafe fn peekdata(pid: Pid, addr: c_long) -> Result { +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd ptrace(ptrace::PTRACE_PEEKDATA, pid, addr as *mut c_void, ptr::null_mut()) } @@ -223,13 +241,18 @@ pub unsafe fn peekdata(pid: Pid, addr: usize) -> Result { /// This function allows to access arbitrary data in the traced process /// and may crash the inferior or introduce race conditions if used /// incorrectly and is thus marked `unsafe`. +<<<<<<< HEAD pub unsafe fn pokedata(pid: Pid, addr: usize, val: Word) -> Result<()> { +======= +pub unsafe fn pokedata(pid: Pid, addr: c_long, val: c_long) -> Result<()> { +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd ptrace( ptrace::PTRACE_POKEDATA, pid, addr as *mut c_void, val as *mut c_void, ).map(|_| ()) // ignore the useless return value +<<<<<<< HEAD } @@ -255,3 +278,6 @@ mod tests { assert_eq!(len, 0); } } +======= +} +>>>>>>> 067f937f087c4fe00b7281d9829f33a3dae4a9bd