GNU GDB expects PT_STEP to be defined for the aarch64 target and supported by the kernel. In case of undefined, it redefines it to 9 in dist/gdb/nat/gdb_ptrace.h: #ifndef PT_STEP # ifdef PT_SINGLE1 # define PT_STEP PT_SINGLE1 # else # define PT_STEP 9 /* Single step the child. */ # endif #endif On NetBSD 9 is PT_ATTACH. This causes EBUSY error from GDB as it attempts to set an early trap followed by a single-step and this results with an error. aarch64 implements software instruction to perform a hardware assisted single-step. GDB expects this behavior to be implemented by OS. FreeBSD already supports this feature: https://github.com/freebsd/freebsd/commit/f0c954c605dca38f4db001f41011e1ae332e2408 A partial support for PT_STEP for arm64 exists in OpenBSD: https://github.com/openbsd/src/commit/c7d5b2ab1872bf2eefdcf3e1b4abd4af5cdacafa I recommend to add support for PT_STEP in aarch64, following FreeBSD and other featured OSes. Existing ATF-tests for single-step probably shall be modified and adapted for the aarch64 specifics. As far as I understand, we must insert trap instruction into tracee's .text section.
Description: OpenPGP digital signature