代码(m1.cpp):
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
cout << "running m1" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
GDB版本:GNU gdb(GDB)7.6.2
建造使用: g++ -g m1.cpp
命令行历史记录:
(gdb) b main
Breakpoint 1 at 0x40087b: file m1.cpp, line 6.
(gdb) r
Starting program: .../a.out
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaaac16a0 in strcmp () from /lib64/ld-linux-x86-64.so.2
(gdb) c
Continuing.
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb)
Run Code Online (Sandbox Code Playgroud)
当我在没有设置任何断点的情况下运行时,它运行没有错误.
按照要求:
(gdb) bt
#0 strcmp () …Run Code Online (Sandbox Code Playgroud)