JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Solaris Dynamic Tracing Guide
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Types, Operators, and Expressions

3.  Variables

4.  D Program Structure

5.  Pointers and Arrays

6.  Strings

7.  Structs and Unions

8.  Type and Constant Definitions

9.  Aggregations

10.  Actions and Subroutines

11.  Buffers and Buffering

12.  Output Formatting

13.  Speculative Tracing

14.  dtrace(1M) Utility

15.  Scripting

16.  Options and Tunables

17.  dtrace Provider

BEGIN Probe

The END Probe

ERROR Probe

Stability

18.  lockstat Provider

19.  profile Provider

20.  fbt Provider

21.  syscall Provider

22.  sdt Provider

23.  sysinfo Provider

24.  vminfo Provider

25.  proc Provider

26.  sched Provider

27.  io Provider

28.  mib Provider

29.  fpuinfo Provider

30.  pid Provider

31.  plockstat Provider

32.  fasttrap Provider

33.  User Process Tracing

34.  Statically Defined Tracing for User Applications

35.  Security

36.  Anonymous Tracing

37.  Postmortem Tracing

38.  Performance Considerations

39.  Stability

40.  Translators

41.  Versioning

Glossary

Index

ERROR Probe

The 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 Errors

BEGIN
{
    *(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:

arg1
The enabled probe identifier (EPID) of the probe that caused the error
arg2
The index of the action that caused the fault
arg3
The DIF offset into that action or -1 if not applicable
arg4
The fault type
arg5
Value particular to the fault type

The table below describes the various fault types and the value that arg5 will have for each:

arg4 Value
Description
arg5 Meaning
DTRACEFLT_UNKNOWN
Unknown fault type
None
DTRACEFLT_BADADDR
Access to unmapped or invalid address
Address accessed
DTRACEFLT_BADALIGN
Unaligned memory access
Address accessed
DTRACEFLT_ILLOP
Illegal or invalid operation
None
DTRACEFLT_DIVZERO
Integer divide by zero
None
DTRACEFLT_NOSCRATCH
Insufficient scratch space to satisfy scratch allocation
None
DTRACEFLT_KPRIV
Attempt to access a kernel address or property without sufficient privileges
Address accessed or 0 if not applicable
DTRACEFLT_UPRIV
Attempt to access a user address or property without sufficient privileges
Address accessed or 0 if not applicable
DTRACEFLT_TUPOFLOW
DTrace internal parameter stack overflow
None

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.