2017-08-06 95 views
0

我試圖設置遠程調試與LLDB 4.0.1。 有一個docker(17.06.0-ce)容器與Arch linux。 碼頭集裝箱設置在privileged mode,所以現在LLDB可以在容器中啓動。 容器包含Rust可執行文件的core_service。遠程LLDB調試 - 碼頭集裝箱

命令內側容器運行 (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-服務器內側容器開始使用lldb-server platform --server --listen 0.0.0.0:1234存在。 我可以從主機lldb連接到容器lldb-server,但我無法附加/創建進程。

命令在主機上運行(在容器LLDB服務器=本地主機: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

我怎樣才能解決這個問題?是否有任何碼頭,拱Linux設置會導致此錯誤?

看來,像docker容器中的lldb-server權限存在一些問題。

在主機上運行的命令(容器中的lldb服務器) (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命令。

+0

嘗試增加'--cap加= ALL'還,看看是否有幫助?我不知道它會,但只是萬一它 –

+0

@TarunLalwani我嘗試了'--cap-add = ALL',但仍然有同樣的問題。 – Adiqq

+0

看看我的最新答案是否有幫助 –

回答

0

這可能是因爲服務器在主機上看不到任何進程。它仍然封裝在自己的PID名稱空間中。當您啓動LLDB服務器,使用主機名PID空間

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

希望這可以讓你的容器看到所有的主機處理

+0

我試過了,但可執行文件和lldb-server都在容器中運行,所以它沒有幫助。這很奇怪,因爲如果我使用'docker exec -it/bin/bash'並運行lldb,我可以毫無問題地啓動進程。問題只在於lldb-server。現在我還設置了'--pid = host',並可以在我的主機上看到這個進程,所以我嘗試從我的主機lldb連接到它,但它也不起作用,出現同樣的錯誤。 – Adiqq