Skip to content

Commit

Permalink
Update libc dependency (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranweiler authored Aug 13, 2021
1 parent faf4878 commit fce06c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = [
]

[dependencies]
libc = "0.2.66"
libc = "0.2.99"
nix = "0.21.0"
thiserror = "1.0.11"

Expand Down
12 changes: 0 additions & 12 deletions src/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
#[cfg(all(target_os = "android"))]
pub(crate) const PTRACE_GETREGSET: i32 = 0x4204;

#[cfg(all(not(target_os = "android")))]
pub(crate) const PTRACE_GETREGSET: u32 = 0x4204;

#[cfg(all(target_os = "android"))]
pub(crate) const PTRACE_SETREGSET: i32 = 0x4205;

#[cfg(all(not(target_os = "android")))]
pub(crate) const PTRACE_SETREGSET: u32 = 0x4205;

/// Defined in [`include/uapi/linux/elf.h`](https://android.googlesource.com/kernel/common/+/refs/heads/android-mainline/include/uapi/linux/elf.h#421).
const NT_ARM_HW_BREAK: i32 = 0x402;
const NT_ARM_HW_WATCH: i32 = 0x403;
Expand Down
11 changes: 6 additions & 5 deletions src/ptracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use nix::sys::{
use crate::error::{Error, Result, ResultExt};

#[cfg(target_arch = "aarch64")]
use crate::aarch64::{self, PTRACE_GETREGSET, PTRACE_SETREGSET};
use crate::aarch64;

#[cfg(target_arch = "x86_64")]
use crate::x86;
Expand Down Expand Up @@ -46,6 +46,7 @@ pub type Siginfo = libc::siginfo_t;
const WALL: Option<WaitPidFlag> = Some(WaitPidFlag::__WALL);

/// Linux constant defined in `include/uapi/linux/elf.h`.
#[cfg(target_arch = "aarch64")]
const NT_PRSTATUS: i32 = 0x1;

/// A _ptrace-stop_, a tracee state in which it is stopped and ready to accept ptrace
Expand Down Expand Up @@ -144,7 +145,7 @@ impl Tracee {
};

let res = unsafe {
libc::ptrace(PTRACE_GETREGSET, self.pid, NT_PRSTATUS, &mut rv as *mut _ as *mut libc::c_void)
libc::ptrace(libc::PTRACE_GETREGSET, self.pid, NT_PRSTATUS, &mut rv as *mut _ as *mut libc::c_void)
};

nix::errno::Errno::result(res)?;
Expand All @@ -165,7 +166,7 @@ impl Tracee {
};

let res = unsafe {
libc::ptrace(PTRACE_SETREGSET, self.pid, NT_PRSTATUS, &mut rv as *mut _ as *mut libc::c_void)
libc::ptrace(libc::PTRACE_SETREGSET, self.pid, NT_PRSTATUS, &mut rv as *mut _ as *mut libc::c_void)
};

nix::errno::Errno::result(res)?;
Expand Down Expand Up @@ -236,7 +237,7 @@ impl Tracee {
iov_len: std::mem::size_of::<aarch64::user_hwdebug_state>(),
};
let res = unsafe {
libc::ptrace(PTRACE_GETREGSET, self.pid, regtype, &mut rv as *mut _ as *mut libc::c_void)
libc::ptrace(libc::PTRACE_GETREGSET, self.pid, regtype, &mut rv as *mut _ as *mut libc::c_void)
};

nix::errno::Errno::result(res)?;
Expand All @@ -262,7 +263,7 @@ impl Tracee {
iov_len: std::mem::size_of::<aarch64::user_hwdebug_state>(),
};
let res = unsafe {
libc::ptrace(PTRACE_SETREGSET, self.pid, regtype, &mut rv as *mut _ as *mut libc::c_void)
libc::ptrace(libc::PTRACE_SETREGSET, self.pid, regtype, &mut rv as *mut _ as *mut libc::c_void)
};

nix::errno::Errno::result(res)?;
Expand Down

0 comments on commit fce06c4

Please sign in to comment.