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.
shellulimit -c // return 0 if disable. ulimit -c unlimited // this command will enable the coredump feature.
use g++ to compile the program with -g option.
shellg++ -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.
shellgdb t.o core
done !