Mail Archives: djgpp/2000/03/02/11:10:19
On Wed, 1 Mar 2000, Marcus wrote:
> "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> wrote:
> > You can install a handler for the signal SIGSEGV. If that handler
> > longjmp's, then it will indeed work. But if it returns to the same
> > place where the problem happened, the progarm will still crash.
>
> A nice function. Thank you...
> Can I catch all types of crashes with one call?
A single call like this:
signal (SIGSEGV, my_crash_handler);
will cause my_crash_handler to be called for all crashes that result
in a SIGSEGV. If you want to catch other kinds of trouble, like
SIGFPE (e.g., divide by zero) or SIGILL, you need additional calls:
signal (SIGFPE, my_crash_handler);
signal (SIGILL, my_crash_handler);
You handler gets passed the actual signal when it is invoked, so you
could give an appropriate handling to each one of the different
signals in the same function.
- Raw text -