• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Abmcar
0.29D
V2EX  ›  程序员

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

  •  
  •   Abmcar · Jul 4, 2025 · 1117 views
    This topic created in 322 days ago, the information mentioned may be changed or developed.

    我在 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"]
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2770 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:54 · PVG 20:54 · LAX 05:54 · JFK 08:54
    ♥ Do have faith in what you're doing.