bbs
bbs copied to clipboard
Enable strace for docker container
上帝说,要有光。于是就有了光。
KCN: 方便动态调试,docker启动需要允许strace
docker run --cap-add=SYS_PTRACE ...
Links
- 如何在Docker容器内部使用gdb进行debug
- Why strace doesn't work in Docker
- https://github.com/moby/moby/issues/21051#issuecomment-325036902
Online system updated, it seems to work now:
bbs@bbs:~$ gdb /kbs/bin/bbsd
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /kbs/bin/bbsd...done.
(gdb) r
Starting program: /kbs/bin/bbsd
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Inferior 1 (process 310) exited normally]
(gdb) b main
Breakpoint 1 at 0x412850: file bbsd_single.c, line 673.
(gdb) r
Starting program: /kbs/bin/bbsd
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=1, argv=0x7ffd18f648e8) at bbsd_single.c:673
673 bbsd_single.c: No such file or directory.
(gdb) l
668 in bbsd_single.c
(gdb) n
676 in bbsd_single.c
(gdb) n
673 in bbsd_single.c
(gdb) n
676 in bbsd_single.c
(gdb) n
673 in bbsd_single.c
(gdb)