Skip to content

Commit 9cb3962

Browse files
committed
fix: enable RegisterSet and RegisterSetValue for aarch64/musl
1 parent 8a9fcd9 commit 9cb3962

File tree

2 files changed

+65
-23
lines changed

2 files changed

+65
-23
lines changed

src/sys/ptrace/linux.rs

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,25 @@ libc_enum! {
173173

174174
#[cfg(all(
175175
target_os = "linux",
176-
target_env = "gnu",
177176
any(
178-
target_arch = "x86_64",
179-
target_arch = "x86",
180-
target_arch = "aarch64",
181-
target_arch = "riscv64",
182-
)
177+
all(
178+
target_env = "gnu",
179+
any(
180+
target_arch = "x86_64",
181+
target_arch = "x86",
182+
target_arch = "aarch64",
183+
target_arch = "riscv64",
184+
)
185+
)
186+
),
187+
any(
188+
all(
189+
target_env = "musl",
190+
any(
191+
target_arch = "aarch64",
192+
)
193+
)
194+
),
183195
))]
184196
libc_enum! {
185197
#[repr(i32)]
@@ -196,13 +208,25 @@ libc_enum! {
196208

197209
#[cfg(all(
198210
target_os = "linux",
199-
target_env = "gnu",
200211
any(
201-
target_arch = "x86_64",
202-
target_arch = "x86",
203-
target_arch = "aarch64",
204-
target_arch = "riscv64",
205-
)
212+
all(
213+
target_env = "gnu",
214+
any(
215+
target_arch = "x86_64",
216+
target_arch = "x86",
217+
target_arch = "aarch64",
218+
target_arch = "riscv64",
219+
)
220+
)
221+
),
222+
any(
223+
all(
224+
target_env = "musl",
225+
any(
226+
target_arch = "aarch64",
227+
)
228+
)
229+
),
206230
))]
207231
/// Represents register set areas, such as general-purpose registers or
208232
/// floating-point registers.
@@ -219,15 +243,28 @@ pub unsafe trait RegisterSet {
219243
type Regs;
220244
}
221245

246+
222247
#[cfg(all(
223248
target_os = "linux",
224-
target_env = "gnu",
225249
any(
226-
target_arch = "x86_64",
227-
target_arch = "x86",
228-
target_arch = "aarch64",
229-
target_arch = "riscv64",
230-
)
250+
all(
251+
target_env = "gnu",
252+
any(
253+
target_arch = "x86_64",
254+
target_arch = "x86",
255+
target_arch = "aarch64",
256+
target_arch = "riscv64",
257+
)
258+
)
259+
),
260+
any(
261+
all(
262+
target_env = "musl",
263+
any(
264+
target_arch = "aarch64",
265+
)
266+
)
267+
),
231268
))]
232269
/// Register sets used in [`getregset`] and [`setregset`]
233270
pub mod regset {

test/sys/test_ptrace.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,17 @@ fn test_ptrace_interrupt() {
179179
// ptrace::{setoptions, getregs} are only available in these platforms
180180
#[cfg(all(
181181
target_os = "linux",
182-
target_env = "gnu",
183182
any(
184-
target_arch = "x86_64",
185-
target_arch = "x86",
186-
target_arch = "aarch64",
187-
target_arch = "riscv64",
183+
all(
184+
target_env = "gnu",
185+
any(
186+
target_arch = "x86_64",
187+
target_arch = "x86",
188+
target_arch = "aarch64",
189+
target_arch = "riscv64"
190+
)
191+
),
192+
all(target_env = "musl", target_arch = "aarch64")
188193
)
189194
))]
190195
#[test]

0 commit comments

Comments
 (0)