Home > Back-end >  How to make the program at the time of crash record something
How to make the program at the time of crash record something

Time:02-13

 
# include & lt; Stdio. H>
# include & lt; Signal. H>

Void crash_handler (int sig)
{
Printf (" crash_handler! \n");
}

Int main ()
{
Signal (SIGTERM, crash_handler);
Signal (SIGINT, crash_handler);
Signal (SIGABRT crash_handler);
Signal (SIGSEGV crash_handler);
Signal (SIGFPE, crash_handler);
Signal (SIGABRT crash_handler);

Int a=5, b=0;
Int c=a/b;

getchar();
}
Why didn't the program calls when crash handler
To record something when crash your program know how don't

CodePudding user response:

Record the DMP file,
https://blog.csdn.net/aoshilang2249/article/details/46565091

Why the collapse DMP file

CodePudding user response:

No problem, the program infinite loop?
 void crash_handler (int sig) 
{
Printf (" crash_handler! \n");
The exit (1);//add here
}
  • Related