1
我去这个简单的代码来测试我的GDB(GNU GDB(Ubuntu的7.11.1-0ubuntu1〜16.04)7.11.1),我的Linux泊坞窗内运行,而且代码:为什么GDB不能在断点处停下来?
// hello.cc
#include <iostream>
int main() {
std::cout << "hello world!" << std::endl;
}
我编译它搭配:
$ g++ -g -o out.a hello.cc
和调试它像:
(gdb) file out.a
(gdb) b main
Note: breakpoint 1 also set at pc 0x40084a.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x000000000040084a in main() at hello.cc:3
(gdb) r
hello world!
During startup program exited normally.
为什么GDB没有停止过main
?
可能不是你的主要问题,但'out.a'是一个非常糟糕的可执行文件命名选择。 –
看起来非常类似于这个问题http://stackoverflow.com/q/34856092/72178。试试'docker run --privileged'。 – ks1322
@PaulR:只是着名的'a.out'的一个笑话,我认为GDB不会把它当作一个静态库来对待:) – coanor