我构建了一个 docker 镜像,其中安装了gcc
binutils 和gdb
调试器。
我会将该 docker 容器附加到在同一 Linux 主机上运行的容器gdb
内的进程。该容器使用自己的命名空间,因此在 docker 容器中运行会抱怨目标进程和调试器不在同一个命名空间中。lxc
lxc
PID
gdb
PID
[SR-PCE-251:~]$ docker run -it --pid host --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined carlo/ubuntu
root@e7b2db23af34:/#
root@e7b2db23af34:/# id
uid=0(root) gid=0(root) groups=0(root)
root@e7b2db23af34:/#
root@e7b2db23af34:/# gdb -q attach 11365
attach: No such file or directory.
Attaching to process 11365
[New LWP 24283]
[New LWP 20025]
[New LWP 20024]
[New LWP 19992]
[New LWP 19991]
[New LWP 13974]
[New LWP 13970]
[New LWP 13969]
[New LWP 13968]
[New LWP 13967]
[New LWP 13962]
[New LWP 13958]
[New LWP 13957]
[New LWP 13954]
[New LWP 13952]
[New LWP 13944]
[New LWP 12078]
[New LWP 11822]
[New LWP 11543]
[New LWP 11515]
[New LWP 11489]
[New LWP 11483]
[New LWP 11482]
[New LWP 11477]
[New LWP 11476]
warning: "target:/proc/11365/exe": could not open as an executable file: Operation not permitted.
warning: `target:/proc/11365/exe': can't open to read symbols: Operation not permitted.
warning: Could not load vsyscall page because no executable was specified
warning: Target and debugger are in different PID namespaces; thread lists and other data are likely unreliable. Connect to gdbserver inside the container.
0x00007f0bf997ac73 in ?? ()
(gdb)
我怎样才能摆脱它?