Skip to content

Commit

Permalink
Enabling only linux x86, x86_64 gnu
Browse files Browse the repository at this point in the history
  • Loading branch information
wpovell committed Jan 10, 2019
1 parent 41b1475 commit f1840c4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/sys/ptrace/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ use sys::signal::Signal;

pub type AddressType = *mut ::libc::c_void;

#[cfg(any(all(target_os = "linux", any(target_arch = "x86_64",
target_arch = "i686"))))]
#[cfg(all(target_os = "linux",
any(target_arch = "x86_64",
target_arch = "x86"),
target_env = "gnu"))]
use libc::user_regs_struct;

cfg_if! {
Expand Down Expand Up @@ -197,15 +199,19 @@ fn ptrace_peek(request: Request, pid: Pid, addr: AddressType, data: *mut c_void)
}

/// Get user registers, as with `ptrace(PTRACE_GETREGS, ...)`
#[cfg(any(all(target_os = "linux", any(target_arch = "x86_64",
target_arch = "i686"))))]
#[cfg(all(target_os = "linux",
any(target_arch = "x86_64",
target_arch = "x86"),
target_env = "gnu"))]
pub fn getregs(pid: Pid) -> Result<user_regs_struct> {
ptrace_get_data::<user_regs_struct>(Request::PTRACE_GETREGS, pid)
}

/// Set user registers, as with `ptrace(PTRACE_SETREGS, ...)`
#[cfg(any(all(target_os = "linux", any(target_arch = "x86_64",
target_arch = "i686"))))]
#[cfg(all(target_os = "linux",
any(target_arch = "x86_64",
target_arch = "x86"),
target_env = "gnu"))]
pub fn setregs(pid: Pid, regs: user_regs_struct) -> Result<()> {
let res = unsafe {
libc::ptrace(Request::PTRACE_SETREGS as RequestType,
Expand Down

0 comments on commit f1840c4

Please sign in to comment.