我在 M 系列的 Mac 上,尝试通过 Docker 运行 x86_64 (amd64) 架构的 Linux 镜像,并在容器内用 LLDB 对程序进行调试。发现无论怎么配置(比如加上 --privileged 、--cap-add=SYS_PTRACE 、--security-opt seccomp=unconfined ),LLDB 都不可用,报错结果为
error: 'A' packet returned an error: -1
但是如果换成 aarch 的镜像就没有问题,可以正常使用 lldb ,有没有大佬知道是怎么回事?
测试用的 dockerfile
FROM --platform=linux/arm64 ubuntu:22.04
RUN apt update && apt install -y lldb clang
COPY hello.c /hello.c
RUN clang -g -o /hello /hello.c
CMD ["/bin/bash"]
FROM --platform=linux/amd64 ubuntu:22.04
RUN apt update && apt install -y lldb clang
COPY hello.c /hello.c
RUN clang -g -o /hello /hello.c
CMD ["/bin/bash"]