How to single step ARM assembly in GDB on QEMU?

Your problem here is that you’re trying to run an ARM gdb under QEMU’s user-mode emulation. QEMU doesn’t support the ptrace syscall (that’s what syscall number 26 is), so this is never going to work.

What you need to do is run your test binary under QEMU with the QEMU options to enable QEMU’s own builtin gdb stub which will listen on a TCP port. Then you can run a gdb compiled to run on your host system but with support for ARM targets, and tell that to connect to the TCP port.

(Emulating ptrace within QEMU is technically very tricky, and it would not provide much extra functionality that you can’t already achieve via the QEMU builtin gdbstub. It’s very unlikely it’ll ever be implemented.)

Leave a Comment