Catch

Use

Returns process control to the debugger when the given signal is generated. Also turns on notification for a specified ON-unit, or all default ON-units.

Command Syntax

CATCH {/DEFAULT | [/NIGNORE|/IGNORE] signal}

or

CATCH {ON-unit}{/DEFAULT}

where:

signal
Can be either a signal name mnemonic (such as SIGALRM, SIGINT, and so on) or the signal number corresponding to that mnemonic. Signal names may be specified in either uppercase or lowercase letters.
ON-unit
The name of an ON-unit at which you want notification whenever the debugger detects a condition that triggers the ON-unit.

Description

The occurrence of a signal that is set to be caught and ignored (/IGNORE) returns process control to the debugger. When the child process subsequently resumes (for example, by using Step or Continue), it continues as if it had not incurred the given signal.

The occurrence of a signal that is set to be caught and not ignored (/NIGNORE), returns process control to the debugger. When the child process subsequently resumes, it continues as if it had incurred the given signal. The occurrence of a signal that is not set to be caught does not return process control to the debugger.

By default, certain signals and on-units are caught by the debugger. The Default option resets all CATCH settings back to the debugger's default settings.

Use the LCATCH /ALL command to get a list of current signal and on-unit settings.

Note: The signals SIGILL and SIGTRAP are permanently set to be ignored by the debugger. These are special signals because they are used by the debugger for breakpoints. You cannot modify the settings for these two signals.

Example

In the following example, process control returns from the child process to the debugger when SIGALRM is generated.

CodeWatch> CATCH /IGNORE SIGALRM
Changing SIGALRM to be caught and ignored.

When the child process resumes, it ignores the SIGALRM and continues as if it had never generated a SIGALRM.

In the following example, the number 28 represents the signal SIGWINCH. Process control returns from the child process to the debugger when a SIGWINCH is generated.

CodeWatch> CATCH /NIGNORE 28
Changing SIGWINCH to be caught and not ignored.

When the child process resumes, it recognizes the signal SIGWINCH and continue as if it had incurred a SIGWINCH.

This example turns on notification for an endfile ON-unit.

CodeWatch> CATCH ENDFILE
Adding ENDFILE to be caught.
Note: The /IGNORE and /NIGNORE flags are not used specifying an ON-unit with CATCH, and are ignored with the message shown in this example:
CodeWatch> CATCH /IGNORE ENDFILE
/IGNORE and NIGNORE flags are not allowed with On units - ignored.
Adding ENDFILE to be caught.