- SIGTRAP
Infobox Computing signal
description = Trace/breakpoint trap
action = Abnormal termination of the process
TRAP_BRKPT | Process breakpoint
TRAP_TRACE | Process trace trapOnPOSIX -compliant platforms, SIGTRAP is the signal thrown bycomputer program s when a condition arises that adebugger has requested to be informed of. Insource code , SIGTRAP is a symbolic constant defined in theheader file
. Signal names are used instead of bare numbers because signal numbers can vary across platforms.signal.h Etymology
"SIG" is a common prefix for signal names. "TRAP" refers to the intent of a debugger to trap (detect) an interesting condition.
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 particularvariable 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.
Wikimedia Foundation. 2010.