SIGTRAP
From Wikipedia, the free encyclopedia
Description: | Trace/breakpoint trap |
---|---|
Default action: | Abnormal termination of the process |
SA_SIGINFO macros | |
TRAP_BRKPT |
Process breakpoint |
TRAP_TRACE |
Process trace trap |
On POSIX-compliant platforms, SIGTRAP is the signal thrown by computer programs when a condition arises that a debugger has requested to be informed of. In source code, SIGTRAP is a symbolic constant defined in the header file signal.h
. Signal names are used instead of bare numbers because signal numbers can vary across platforms.
[edit] Etymology
SIG is a common prefix for signal names. TRAP refers to the intent of a debugger to trap (detect) an interesting condition.
[edit] Usage
When debugging a program, it is often useful to run the program until a particular condition arises — for example, when a particular function is executed, or when a particular variable changes value. Although the debugger could repeatedly pause the program, checking the condition at each instruction, to do so would be very slow. More efficient is to request that the hardware itself determine when a condition obtains (e.g. when a particular memory segment is read, written or executed) and signal when this happens; this signal is then converted by the kernel into SIGTRAP, sent to the process being debugged. The debugger catches the signal, confirms for itself whether the condition has occurred, and if so pauses execution of the process and informs the developer.
POSIX Signals |
SIGABRT | SIGALRM | SIGFPE | SIGHUP | SIGILL | SIGINT | SIGKILL | SIGPIPE | SIGQUIT | SIGSEGV | SIGTERM | SIGUSR1 | SIGUSR2 | SIGCHLD | SIGCONT | SIGSTOP | SIGTSTP | SIGTTIN | SIGTTOU | SIGBUS | SIGPOLL | SIGPROF | SIGSYS | SIGTRAP | SIGURG | SIGVTALRM | SIGXCPU | SIGXFSZ | Realtime Signals are user definable—SIGRTMIN+n through SIGRTMAX. |
Common non-POSIX signals and synonyms |
SIGIOT | SIGEMT | SIGSTKFLT | SIGIO | SIGCLD | SIGINFO | SIGPWR (SIGINFO) | SIGLOST | SIGWINCH | SIGUNUSED |