> Any one has idea of how to handle signaling in program run time errors.
> I mean not just signal handler..i want to know the exact reason of error.
> Well "extern int errno" is not updated when an abrupt signal is thrown like
> SIGSEGV etc..example. like we use gdb and find out with registers where
> error of memory occured can't we handle that in program itself..
> We can register signal handler but its (void (*)(int)) where we can only
> obtain signal number and my question is how to trap the exact error of that
You really have to be careful what you attempt to do in a signal
handler, especially when the signal indicates that the heap
or the stack has been compromised. In those circumstances,
it may be impossible to do anything meaningful to recover from
the error, and it may be very difficult to even output indications
of the program failure. The difficulty in this latter case is that
many of the output routines like printf and cout use memory allocation
which may cause more errors if the heap is corrupted.