gdb does not hit any breakpoints when I run it from inside Docker container

后端 未结 3 2137
天涯浪人
天涯浪人 2020-12-30 04:09

The problem

I am able to set and reach a breakpoint if I compile and run from the host, but if I do it from within the docker container gdb does not

3条回答
  •  爱一瞬间的悲伤
    2020-12-30 04:47

    Rather than elevating the entire container, I was able to use the option

    --security-opt seccomp=unconfined
    

    to fix address space randomization problems.

    Some also recommend enabling the ptrace capability with

    --cap-add=SYS_PTRACE
    

    but this didn't seem to have any effect for me.

    Here are the same settings for Docker compose:

    security_opt:
      - seccomp:unconfined
    cap_add:
      - SYS_PTRACE
    

    Details are taken from this Stack Overflow post.

提交回复
热议问题