2

I use Docker to run Debian(arch is ARM64) container and my host machine is x86_64. When use GDB for debuging files, I get this erro:

warning: Could not trace the inferior process. Error: warning: ptrace: Function not implemented During startup program exited with code 127.

And I have add --privileged to my container, I also get this problem. Container’s arch is x86_64 with host arch is x86_64 is ok. In other question, someone say is about to qemu not support ptrace.Anyone can solve this problem. Thanks!

yiwanmian
  • 2,321
  • 2
  • 10
  • 5

2 Answers2

1

You can't run an emulated gdb inside QEMU's usermode emulation. Instead you need to run a gdb built for your host architecture but with support for debugging executables for your guest architecture, and connect that to QEMU's builtin gdbstub. See also this answer: https://stackoverflow.com/a/28241508/4499941

Peter Maydell
  • 9,707
  • 1
  • 19
  • 25
0

solution: https://github.com/docker/for-mac/issues/5191

stephen-turner commented on May 7, 2021 Closing this ticket. @cpuguy83 has explained (#5191 (comment)) why it cannot work. qemu emulation is only ever best-effort: the solution is to run arm64 containers on M1 hardware.

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323