Criei uma imagem docker com gcc
o binutils e gdb
o debugger instalados dentro.
Eu anexaria gdb
desse contêiner docker a um processo dentro de um lxc
contêiner em execução no mesmo host Linux. O lxc
contêiner usa seu próprio PID
namespace, portanto, gdb
a execução no contêiner docker reclama que o processo de destino e o depurador não estão no mesmo PID
namespace.
[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)
Como posso me livrar disso?