Closed lauccode closed 2 years ago
gdb -i=mi /docker:name_of_docker_container:/mnt/build/logicalError -ex "set substitute-path /home/name_on_manjaro/CPP-Debug-Docker/ /mnt/"
gdb -i=mi /docker:name_of_docker_container:/mnt/build/logicalError
to launch the docker daemon
sudo dockerd
to be able to pass following command in another terminal
sudo chmod 666 /var/run/docker.sock
to build and run the docker
cd CPP-Debug-Docker
docker build -f cpp.Dockerfile -t cpp-debug:0.0.1 .\n
docker run -it --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/mnt cpp-debug:0.0.1
to know your container name to pass in gdb command in another terminal
docker container ls
<Alt+x> gud-gdb is launched with the same command that gdb but with "--fullname" option rather than "-i=mi" at the start.
gdb --fullname /docker:name_of_docker_container:/mnt/build/logicalError -ex "set substitute-path /home/name_on_manjaro/CPP-Debug-Docker/ /mnt/"
If I launch <Alt+x> gdb, there is no code following with the arrow. But We can see the breakpoint. If I launch <Alt+x> gud-gdb, there is code following with the arrow. But We can not see the breakpoint.
Hello,
I'm trying to use gdb on code in a docker but it is not working well. I can debug with gud-gdb(console on left and code on right) but not with gdb "gdb -i=mi" (with all information in 6 windows).
I tried it on manjaro (and also ubuntu) with diferent projet. To be sure, I tested with this simple projet to reproduce with "hello world" and a docker and I have the same result : https://github.com/leimao/CPP-Debug-Docker.
The issue is that I can only follow the code progress in gdb console but not directly on the code file with the arrow. No issue if not in docker.
I'm launching gdb in emacs with this command after <Alt+x>, gdb : gdb -i=mi /docker:reverent_black:/mnt/build/logicalError -ex "set substitute-path /home/name_on_manjaro/CPP-Debug-Docker/ /mnt/" I was expecting no issue because of "set substitute-path".
config is : OS: Manjaro Linux x86_64 KDE, updated Kernel: 5.10.98-1-MANJARO Shell: bash 5.1.16
DOOM with GNU Emacs 27.2
I guess something is missing but I don't see what.
Thanks for help Regards