|
|||||||||||||||||||||||||||||||||||||||||
2. Types, Operators, and Expressions 8. Type and Constant Definitions 34. Statically Defined Tracing for User Applications |
ERROR ProbeThe ERROR probe fires when a run-time error occurs in executing a clause for a DTrace probe. For example, if a clause attempts to dereference a NULL pointer, the ERROR probe will fire, as shown in the following example. Example 17-1 error.d: Record ErrorsBEGIN { *(char *)NULL; } ERROR { printf("Hit an error!"); } When you run this program, you will see output like the following example: # dtrace -s ./error.d dtrace: script './error.d' matched 2 probes CPU ID FUNCTION:NAME 2 3 :ERROR Hit an error! dtrace: error on enabled probe ID 1 (ID 1: dtrace:::BEGIN): invalid address (0x0) in action #1 at DIF offset 12 dtrace: 1 error on CPU 2 The output shows that the ERROR probe fired, and also illustrates dtrace(1M) reporting the error. dtrace has its own enabling of the ERROR probe to allow it to report errors. Using the ERROR probe, you can create your own custom error handling. The arguments to the ERROR probe are as follows:
The table below describes the various fault types and the value that arg5 will have for each:
If the actions taken in the ERROR probe itself cause an error, that error is silently dropped — the ERROR probe will not be recursively invoked. |
||||||||||||||||||||||||||||||||||||||||
|