If the program fails, the debugger will tell you where. But to know the line where it fails is not always enough because it can be within a function which is called at many different places. We must also know the sequence of function call. The easiest for that is to use the standard C function "atexit" from the library stdlib:
#include <stdlib.h}
...
void myexit()
{
cout << "Fin" << endl;
}
...
void main()
{
atexit(myexit);
...
}
A breakpoint should be put on the line"cout<<"Fin"..." so that the debugger will stop on this line if there is an interruption caused by the Unix system. The effect of the function atexit(func) is to force the execution of the function whose name is the parameter in case of system interrupt or normal exit. After that, typing a "where" will give the history of functionc calls.