编辑
2023-12-09
技术
0
请注意,本文编写于 515 天前,最后修改于 515 天前,其中某些信息可能已经过时。

firstly. test cpp file show below.

cpp
// t.cpp #include <iostream> #include <stdio.h> int main() { char* c = NULL; printf("%d", *c); return 0; }

to check if the coredump enabled in your system by.

shell
ulimit -c // return 0 if disable. ulimit -c unlimited // this command will enable the coredump feature.

use g++ to compile the program with -g option.

shell
g++ -g t.cpp -o t.o // complile ./t.o // this command will run into fail // message is "Segmentation fault (core dumped)" // and a file named "core" is generated.

now you can use gdb to debug the code.

shell
gdb t.o core

done !

如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:Santiago Chou

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 无版权要求,都是一些日常话题。 许可协议。转载请注明出处!