use err::*;
#[inline]
pub fn trace_me() -> Result<(), Error> { unsafe { esyscall_!(PTRACE, ::libc::PTRACE_TRACEME) } }
pub struct Trace(pub ::libc::id_t);
macro_rules! ptrace_raw {
($r:ident $(, $x:tt)*) =>
(esyscall!(PTRACE, concat_idents!(::libc::PTRACE_, $r), self.0, $(, $x)*))
}
macro_rules! ptrace_raw_ {
($r:ident $(, $x:tt)*) => (ptrace_raw!($r $(, $x:tt)*).map(|_| ()))
}
impl Trace {
#[inline]
pub fn peek(&self, p: *mut usize) -> Result<usize, Error> { unsafe {
let x: usize = mem::uninitialized();
try!(ptrace_raw!(PEEKDATA, p, &mut x as *mut _));
Ok(x)
} }
#[inline]
pub fn peek_user(&self, i: usize) -> Result<usize, Error> { unsafe {
let x: usize = mem::uninitialized();
try!(ptrace_raw!(PEEKUSER, i, &mut x as *mut _));
Ok(x)
}
#[inline]
pub fn poke(&self, p: *mut usize, x: usize) -> Result<(), Error> { unsafe {
ptrace_raw_!(POKEDATA, p, x)
} }
#[inline]
pub fn poke_user(&self, i: usize, x: usize) -> Result<(), Error> { unsafe {
ptrace_raw_!(POKEUSER, i, x)
} }
#[inline]
pub fn get_regs(&self) -> Result<Regs, Error> { unsafe {
let x: Regs =
} }
}