DEV Community

Cover image for Program Error Signals
Sakshi
Sakshi

Posted on

Program Error Signals

Signals in computers are a way of communication between the process and the OS. When a running program undergoes some serious error then the OS sends a signal to the process and the process further may not execute. Some processes may have a signal handler that does some important tasks before the process leaves the CPU.

Error signals generally cause termination of the program and a core dump file is created named core, which stores the state of the process at the moment of termination. This file can be investigated using the debugger to know the cause of program termination.

SIGFPE –

This error signal denotes some arithmetic error that occurred like division by zero, or floating-point error.

SIGILL –

This signal denotes illegal instruction. When a garbage instruction or instruction that a program has no privilege to execute, is executed then this signal is generated.

SIGSEGV –

The signal is generated when a process tries to access a memory location not allocated to it, like de-referencing a wild pointer which leads to a “segmentation fault”.

SIGBUS –

The name is an abbreviation for “Bus error”. This signal is also produced when an invalid memory is accessed.

SIGABRT –

If an error itself is detected by the program then this signal is generated using call to abort(). This signal is also used by the standard library to report an internal error. assert() function in c++ also uses abort() to generate this signal.

Image description

SIGSYS –

This signal is sent to process when an invalid argument is passed to a system call.

SIGTRAP –

This signal is sent to process when an exception has occurred. This is requested by the debugger to get informed. For example, if a variable changes its value then this will trigger it.

Thanks for reading
Hope you will find it helpful

Top comments (0)