Skip to content

Commit

Permalink
fix: enable RegisterSet and RegisterSetValue for aarch64/musl
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Sep 22, 2024
1 parent 6055f8e commit d6b9c2f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 23 deletions.
73 changes: 55 additions & 18 deletions src/sys/ptrace/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,25 @@ libc_enum! {

#[cfg(all(
target_os = "linux",
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
all(
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
)
),
any(
all(
target_env = "musl",
any(
target_arch = "aarch64",
)
)
),
))]
libc_enum! {
#[repr(i32)]
Expand All @@ -196,13 +208,25 @@ libc_enum! {

#[cfg(all(
target_os = "linux",
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
all(
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
)
),
any(
all(
target_env = "musl",
any(
target_arch = "aarch64",
)
)
),
))]
/// Represents register set areas, such as general-purpose registers or
/// floating-point registers.
Expand All @@ -219,15 +243,28 @@ pub unsafe trait RegisterSet {
type Regs;
}


#[cfg(all(
target_os = "linux",
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
all(
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
)
)
),
any(
all(
target_env = "musl",
any(
target_arch = "aarch64",
)
)
),
))]
/// Register sets used in [`getregset`] and [`setregset`]
pub mod regset {
Expand Down
15 changes: 10 additions & 5 deletions test/sys/test_ptrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,17 @@ fn test_ptrace_interrupt() {
// ptrace::{setoptions, getregs} are only available in these platforms
#[cfg(all(
target_os = "linux",
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64",
all(
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x86",
target_arch = "aarch64",
target_arch = "riscv64"
)
),
all(target_env = "musl", target_arch = "aarch64")
)
))]
#[test]
Expand Down

0 comments on commit d6b9c2f

Please sign in to comment.