我想使用eclipse IDE作爲前端GUI來調試另一個在我的主機中停泊的OS的核心文件。通過Docker中的'gdbserver',我只能調試正在運行的進程。但是我需要對核心文件進行驗屍調試。使用eclipse進行遠程核心文件分析
我嘗試使用
docker exec -it $DOCKER_CONTAINER bash -c "gdb /usr/bin/executable /opt/crash/executable.core
這個工程使用的外殼部分的/ home/ME /斌/ remote_gdb包裝。因爲
Could not determine GDB version using command: remote_gdb --version
即使「remote_gdb --version」打印出完全一樣的原始「的gdb --version」,但它沒有使用「日蝕」。
我可以做一些工作, 'DDD' 作爲前端 - 讓我練習:
> cd $HOME/SRC
> ls -l
total 4
-rw-rw-r-- 1 frank frank 96 Aug 24 18:04 test.c
> cat test.c
#include <stdio.h>
int main(int argc, char** argv)
{
printf("hello, world!\n");
return 0;
}
> docker run -v $HOME/SRC:/SRC -t fedora /bin/bash
// IN DOCKER NOW:
>> yum install gcc
[...]
>> yum install gdb
[...]
>> cd /SRC
>> gcc -g3 -O0 -o test test.c
>> ls -l
total 40
-rwxr-xr-x 1 root root 34864 Aug 24 16:26 test
-rw-rw-r-- 1 1000 1000 96 Aug 24 16:04 test.c
回到主持人:
> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e501d8384060 fedora "/bin/bash" 4 minutes ago Up 4 minutes stupefied_murdock
> cat $HOME/bin/remote_gdb
#!/bin/bash
docker exec -it e501d8384060 gdb /SRC/test
> remote_gdb # $HOME/bin/ is in $PATH
GNU gdb (GDB) Fedora 8.0-20.fc26
Copyright (C) 2017 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-redhat-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 /SRC/test...done.
(gdb) list
1 #include <stdio.h>
2
3 int main(int argc, char** argv)
4 {
5 printf("hello, world!\n");
6 return 0;
7 }
8
(gdb)
切換回外殼,我在碼頭 - 看到'gdb'正在運行:
>> yum install procps-ng
[...]
>> ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 16:22 ? 00:00:00 /bin/bash
root 16 0 0 16:23 ? 00:00:00 bash
root 116 0 0 16:28 ? 00:00:00 gdb /SRC/test
root 131 16 0 16:30 ? 00:00:00 ps -ef
再次打開主機外殼(在泊塢窗後退出GDB會話):
> ddd --debugger remote_gdb
的 'DDD' 很好用gdb扮演碼頭工人開始。 它也適用於核心文件(添加「睡眠(100);」並殺死進程)。 但是'ddd'沒有一個非常好的GUI。 那麼用'eclipse'做這種工作的方式是什麼? 我也不能使它與其他選項的工作: 'qtcreator', 'KDevelop的', 'nemiver', '工具KDbg' 等
附錄:
它也不會一起工作「 ssh'進入容器。 但是,當我執行相同的'remote_gdb'包裝腳本作爲'外部工具'它可以執行(?!)