首页 文章

远程LLDB调试 - Docker容器

提问于
浏览
0

我'm trying to set up a remote debugging with LLDB 4.0.1. There'是一个带有Arch linux的docker(17.06.0-ce)容器 . Docker容器在privileged mode中设置,因此现在可以在容器中启动LLDB . Container包含core_service,它是Rust可执行文件 .

命令在容器 (lldb) target create target/debug/core_service Current executable set to 'target/debug/core_service' (x86_64). (lldb) process launch Process 182 launched: '/srv/core_service/target/debug/core_service' (x86_64) 内运行

远程调试存在问题,lldb-server在 lldb-server platform --server --listen 0.0.0.0:1234 的容器内启动 . 我可以从主机lldb连接到容器lldb-server,但我无法附加/创建进程 .

命令在主机上运行(lldb-server in container = localhost:1234) (lldb) platform select remote-linux Platform: remote-linux Connected: no (lldb) platform connect connect://localhost:1234 Platform: remote-linux Triple: x86_64-*-linux-gnu OS Version: 4.12.4 (4.12.4-1-ARCH) Kernel: #1 SMP PREEMPT Fri Jul 28 18:54:18 UTC 2017 Hostname: 099bd76c07c9 Connected: yes WorkingDir: /srv/core_service (lldb) target create target/debug/core_service Current executable set to 'target/debug/core_service' (x86_64). (lldb) process launch error: connect remote failed (Connection refused) error: process launch failed: Connection refused

我该如何解决?是否有任何docker,arch linux设置会导致此错误?

看来,就像docker容器中的lldb-server权限存在一些问题一样 .

命令在主机上运行(容器中的lldb-server) (lldb) platform shell ps -A PID TTY TIME CMD 1 ? 00:00:00 bash 9 ? 00:00:00 nginx 10 ? 00:00:00 nginx 11 ? 00:00:00 lldb-server 25 ? 00:00:00 core_service 59 ? 00:00:00 lldb-server 68 ? 00:00:00 ps (lldb) platform shell kill -9 25 (lldb) platform process launch target/debug/core_service error: connect remote failed (Connection refused) error: Connection refused (lldb) platform process launch anything error: connect remote failed (Connection refused) error: Connection refused 但我无法弄清楚它是什么 . lldb-server在容器中以root身份运行,我可以使用lldb执行shell命令 .

1 回答

  • 0

    这可能是因为服务器无法在主机上看到任何进程 . 它仍然包含在自己的PID名称空间中 . 启动LLDB服务器时,请使用主机pid名称空间

    docker run --pid=host --privileged <yourimage>
    

    希望这将允许您的容器查看所有主机进程

相关问题