org.opensolaris.os.dtrace
Class KernelSymbolRecord

java.lang.Object
  extended by org.opensolaris.os.dtrace.KernelSymbolRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<KernelSymbolRecord>, Record, SymbolValueRecord, ValueRecord

public final class KernelSymbolRecord
extends java.lang.Object
implements SymbolValueRecord, java.io.Serializable, java.lang.Comparable<KernelSymbolRecord>

A value generated by the DTrace mod(), func(), or sym() action used to lookup the symbol associated with a kernel address.

Immutable. Supports persistence using XMLEncoder.

See Also:
Serialized Form

Constructor Summary
KernelSymbolRecord(java.lang.String lookupValue, long addressValue)
          Creates a KernelSymbolRecord with the given symbol lookup and kernel address converted in probe context as a result of the DTrace mod(), func(), or sym() action.
 
Method Summary
 int compareTo(KernelSymbolRecord r)
          Compares this record with the given kernel symbol lookup and orders by address.
 boolean equals(java.lang.Object o)
          Compares the specified object with this KernelSymbolRecord for equality.
 long getAddress()
          Gets the symbol's kernel address.
 java.lang.String getSymbol()
          Gets the result of the address lookup in the same form returned by Consumer.lookupKernelFunction(long address).
 java.lang.Long getValue()
          Gets the symbol's kernel address.
 int hashCode()
          Overridden to ensure that equal instances have equal hash codes.
 java.lang.String toString()
          Gets the result of this symbol lookup.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KernelSymbolRecord

public KernelSymbolRecord(java.lang.String lookupValue,
                          long addressValue)
Creates a KernelSymbolRecord with the given symbol lookup and kernel address converted in probe context as a result of the DTrace mod(), func(), or sym() action.

Supports XML persistence.

Parameters:
addressValue - symbol address
lookupValue - the result in the native DTrace library of looking up the symbol associated with the given kernel address
Throws:
java.lang.NullPointerException - if the given lookup value is null
Method Detail

getSymbol

public java.lang.String getSymbol()
Gets the result of the address lookup in the same form returned by Consumer.lookupKernelFunction(long address).

Specified by:
getSymbol in interface SymbolValueRecord
Returns:
non-null address lookup in the format defined by the native DTrace library

getAddress

public long getAddress()
Gets the symbol's kernel address.

Specified by:
getAddress in interface SymbolValueRecord
Returns:
the symbol's kernel address

getValue

public java.lang.Long getValue()
Gets the symbol's kernel address. The value is used in equals() and compareTo() to test equality and to determine the natural ordering of KernelSymbolRecord instances.

Specified by:
getValue in interface ValueRecord
Returns:
non-null value of the symbol's kernel address

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this KernelSymbolRecord for equality. Returns true if and only if the specified object is also a KernelSymbolRecord and both records have the same address.

Overrides:
equals in class java.lang.Object
Returns:
true if and only if the specified object is also a KernelSymbolRecord and both records have the same address

hashCode

public int hashCode()
Overridden to ensure that equal instances have equal hash codes.

Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(KernelSymbolRecord r)
Compares this record with the given kernel symbol lookup and orders by address. The comparison treats addresses as unsigned values so the ordering is consistent with that defined in the native DTrace library. The compareTo() method is compatible with equals().

Specified by:
compareTo in interface java.lang.Comparable<KernelSymbolRecord>
Returns:
-1, 0, or 1 as this record's address is less than, equal to, or greater than the given record's address

toString

public java.lang.String toString()
Gets the result of this symbol lookup. The format is defined in the native DTrace library and is as stable as that library definition.

Overrides:
toString in class java.lang.Object
Returns:
getSymbol()