如何在 M 系列的 Mac 上使用 x86 docker image 内的 lldb 调试容器内的 cpp 程序?

62 天前
 Abmcar

我在 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"]
818 次点击
所在节点    程序员
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1143005

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX