org.opensolaris.os.dtrace
Class Error

java.lang.Object
  extended by org.opensolaris.os.dtrace.Error
All Implemented Interfaces:
java.io.Serializable

public final class Error
extends java.lang.Object
implements java.io.Serializable

An error encountered in the native DTrace library while tracing probe data. Each of the fault name constants beginning with DTRACEFLT_ identifies a specific fault with a name that is guaranteed not to change across API versions.

Immutable. Supports persistence using XMLEncoder.

See Also:
ConsumerListener.errorEncountered(ErrorEvent e), Serialized Form

Field Summary
static java.lang.String DTRACEFLT_BADADDR
          Invalid address.
static java.lang.String DTRACEFLT_BADALIGN
          Invalid alignment.
static java.lang.String DTRACEFLT_DIVZERO
          Divide-by-zero.
static java.lang.String DTRACEFLT_ILLOP
          Illegal operation.
static java.lang.String DTRACEFLT_KPRIV
          Invalid kernel access.
static java.lang.String DTRACEFLT_LIBRARY
          Library-level fault.
static java.lang.String DTRACEFLT_NOSCRATCH
          Out of scratch space.
static java.lang.String DTRACEFLT_TUPOFLOW
          Tuple stack overflow.
static java.lang.String DTRACEFLT_UPRIV
          Invalid user access.
 
Constructor Summary
Error(ProbeDescription pdesc, int enabledProbeID, int errorCPU, int errorAction, int errorOffset, java.lang.String faultName, long faultAddress, java.lang.String errorMessage)
          Creates a DTrace error with the given properties.
 
Method Summary
 int getAction()
          Gets the error-inducing action as the nth action (starting at one) in the error-inducing probe, or zero if the error is in the predicate rather than in an action.
 long getAddress()
          Gets the address of the fault, if any.
 int getCPU()
          Gets the CPU that encountered the error.
 java.lang.String getDefaultMessage()
          Gets the default message from the native DTrace library preconstructed from the properties of this error.
 int getEnabledProbeID()
          Gets the enabled probe ID.
 java.lang.String getFault()
          Gets the name identifying the specific fault.
 int getOffset()
          Gets the error offset in compiled DTrace Intermediate Format (DIF), or a negative number if the offset is not available.
 ProbeDescription getProbeDescription()
          Gets the probe description that identifies the error-inducing probe among all the probes on the system.
 java.lang.String toString()
          Gets a string representation of this error useful for logging and not intended for display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DTRACEFLT_BADADDR

public static final java.lang.String DTRACEFLT_BADADDR
Invalid address.

See Also:
Constant Field Values

DTRACEFLT_BADALIGN

public static final java.lang.String DTRACEFLT_BADALIGN
Invalid alignment.

See Also:
Constant Field Values

DTRACEFLT_ILLOP

public static final java.lang.String DTRACEFLT_ILLOP
Illegal operation.

See Also:
Constant Field Values

DTRACEFLT_DIVZERO

public static final java.lang.String DTRACEFLT_DIVZERO
Divide-by-zero.

See Also:
Constant Field Values

DTRACEFLT_NOSCRATCH

public static final java.lang.String DTRACEFLT_NOSCRATCH
Out of scratch space.

See Also:
Constant Field Values

DTRACEFLT_KPRIV

public static final java.lang.String DTRACEFLT_KPRIV
Invalid kernel access.

See Also:
Constant Field Values

DTRACEFLT_UPRIV

public static final java.lang.String DTRACEFLT_UPRIV
Invalid user access.

See Also:
Constant Field Values

DTRACEFLT_TUPOFLOW

public static final java.lang.String DTRACEFLT_TUPOFLOW
Tuple stack overflow.

See Also:
Constant Field Values

DTRACEFLT_LIBRARY

public static final java.lang.String DTRACEFLT_LIBRARY
Library-level fault.

See Also:
Constant Field Values
Constructor Detail

Error

public Error(ProbeDescription pdesc,
             int enabledProbeID,
             int errorCPU,
             int errorAction,
             int errorOffset,
             java.lang.String faultName,
             long faultAddress,
             java.lang.String errorMessage)
Creates a DTrace error with the given properties. Supports XML persistence.

Parameters:
pdesc - probe description that identifies the error-inducing probe among all the probes on the system
enabledProbeID - identifies the error-inducing probe among all probes enabled by the same Consumer
errorCPU - non-negative ID of the CPU where the error was encountered, or a negative number if the CPU is unknown
errorAction - integer that identifies the error-inducing action as the nth action (starting at one) in the error-inducing probe, or zero if the error is in the predicate rather than in an action
errorOffset - error offset in compiled DTrace Intermediate Format (DIF), or a negative number if the offset is not available
faultName - name of the specific fault, or null if the fault is unknown to the Java DTrace API
faultAddress - address of fault, or -1 if address is not applicable to the specific fault
errorMessage - default message from the native DTrace library preconstructed from the properties of this error
Throws:
java.lang.NullPointerException - if the given probe description or default message is null
Method Detail

getProbeDescription

public ProbeDescription getProbeDescription()
Gets the probe description that identifies the error-inducing probe among all the probes on the system.

Returns:
non-null probe description

getEnabledProbeID

public int getEnabledProbeID()
Gets the enabled probe ID. The "epid" is different from ProbeDescription.getID() because it identifies a probe among all the probes enabled by a Consumer, rather than among all the probes on the system.

Returns:
the enabled probe ID

getCPU

public int getCPU()
Gets the CPU that encountered the error.

Returns:
non-negative CPU ID, or a negative number if the CPU is unknown

getAction

public int getAction()
Gets the error-inducing action as the nth action (starting at one) in the error-inducing probe, or zero if the error is in the predicate rather than in an action. Note that some actions in a D program consist of multiple actions internally within the DTrace library.

Returns:
zero if the error is in the probe predicate, otherwise the nth action (n starting at one) from the start of the probe that induced the error

getOffset

public int getOffset()
Gets the error offset in compiled DTrace Intermediate Format (DIF), or a negative number if the offset is not available.

Returns:
the error offset in compiled DTrace Intermediate Format (DIF), or a negative number if the offset is not available

getFault

public java.lang.String getFault()
Gets the name identifying the specific fault. The names are guaranteed not to change across API versions as long as the fault cases they identify still exist.

Returns:
name of the specific fault or null if the fault is unknown to the Java DTrace API

getAddress

public long getAddress()
Gets the address of the fault, if any.

Returns:
address of fault, or -1 if address is not applicable to the specific fault (the fault is not one of DTRACEFLT_BADADDR or DTRACEFLT_BADALIGN)

getDefaultMessage

public java.lang.String getDefaultMessage()
Gets the default message from the native DTrace library preconstructed from the properties of this error.

Returns:
non-null preconstructed message

toString

public java.lang.String toString()
Gets a string representation of this error useful for logging and not intended for display. The exact details of the representation are unspecified and subject to change, but the following format may be regarded as typical:

 class-name[property1 = value1, property2 = value2]
 

Overrides:
toString in class java.lang.Object