127bbe13a6d36580af6a8ded154f1201a6250772tomee * CDDL HEADER START
127bbe13a6d36580af6a8ded154f1201a6250772tomee * The contents of this file are subject to the terms of the
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Common Development and Distribution License (the "License").
127bbe13a6d36580af6a8ded154f1201a6250772tomee * You may not use this file except in compliance with the License.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
127bbe13a6d36580af6a8ded154f1201a6250772tomee * See the License for the specific language governing permissions
127bbe13a6d36580af6a8ded154f1201a6250772tomee * and limitations under the License.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * When distributing Covered Code, include this CDDL HEADER in each
127bbe13a6d36580af6a8ded154f1201a6250772tomee * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * If applicable, add the following below this CDDL HEADER, with the
127bbe13a6d36580af6a8ded154f1201a6250772tomee * fields enclosed by brackets "[]" replaced with your own identifying
127bbe13a6d36580af6a8ded154f1201a6250772tomee * information: Portions Copyright [yyyy] [name of copyright owner]
127bbe13a6d36580af6a8ded154f1201a6250772tomee * CDDL HEADER END
91cfa10a8e55050a5103c4b2e83b0bf8d783a7cbtomee * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Use is subject to license terms.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * ident "%Z%%M% %I% %E% SMI"
127bbe13a6d36580af6a8ded154f1201a6250772tomee * A value generated by the DTrace {@code mod()}, {@code func()}, or
127bbe13a6d36580af6a8ded154f1201a6250772tomee * {@code sym()} action used to lookup the symbol associated with a
127bbe13a6d36580af6a8ded154f1201a6250772tomee * kernel address.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Immutable. Supports persistence using {@link java.beans.XMLEncoder}.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @author Tom Erickson
127bbe13a6d36580af6a8ded154f1201a6250772tomeepublic final class KernelSymbolRecord implements SymbolValueRecord,
127bbe13a6d36580af6a8ded154f1201a6250772tomee static final long serialVersionUID = -7156627773519296848L;
127bbe13a6d36580af6a8ded154f1201a6250772tomee BeanInfo info = Introspector.getBeanInfo(KernelSymbolRecord.class);
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Need to prevent DefaultPersistenceDelegate from using
127bbe13a6d36580af6a8ded154f1201a6250772tomee * overridden equals() method, resulting in a
127bbe13a6d36580af6a8ded154f1201a6250772tomee * StackOverFlowError. Revert to PersistenceDelegate
127bbe13a6d36580af6a8ded154f1201a6250772tomee * implementation. See
127bbe13a6d36580af6a8ded154f1201a6250772tomee * 477019&tstart=135
127bbe13a6d36580af6a8ded154f1201a6250772tomee protected boolean
127bbe13a6d36580af6a8ded154f1201a6250772tomee d.setValue("persistenceDelegate", persistenceDelegate);
127bbe13a6d36580af6a8ded154f1201a6250772tomee /** @serial */
127bbe13a6d36580af6a8ded154f1201a6250772tomee private String symbol; // set natively after creation; treat as final
127bbe13a6d36580af6a8ded154f1201a6250772tomee /** @serial */
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Called by native code.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Creates a {@code KernelSymbolRecord} with the given symbol lookup
127bbe13a6d36580af6a8ded154f1201a6250772tomee * and kernel address converted in probe context as a result of the
127bbe13a6d36580af6a8ded154f1201a6250772tomee * DTrace {@code mod()}, {@code func()}, or {@code sym()} action.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Supports XML persistence.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @param addressValue symbol address
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @param lookupValue the result in the native DTrace library of
127bbe13a6d36580af6a8ded154f1201a6250772tomee * looking up the symbol associated with the given kernel address
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @throws NullPointerException if the given lookup value is {@code null}
127bbe13a6d36580af6a8ded154f1201a6250772tomee KernelSymbolRecord(String lookupValue, long addressValue)
91cfa10a8e55050a5103c4b2e83b0bf8d783a7cbtomee private final void
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Gets the result of the address lookup in the same form returned
127bbe13a6d36580af6a8ded154f1201a6250772tomee * by {@link Consumer#lookupKernelFunction(long address)}.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return non-null address lookup in the format defined by the
127bbe13a6d36580af6a8ded154f1201a6250772tomee * native DTrace library
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Called by native code and ProbeData addSymbolRecord()
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Gets the symbol's kernel address.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return the symbol's kernel address
127bbe13a6d36580af6a8ded154f1201a6250772tomee public long
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Gets the symbol's kernel address. The value is used in {@link
127bbe13a6d36580af6a8ded154f1201a6250772tomee * #equals(Object o) equals()} and {@link
127bbe13a6d36580af6a8ded154f1201a6250772tomee * #compareTo(KernelSymbolRecord r) compareTo()} to test equality
127bbe13a6d36580af6a8ded154f1201a6250772tomee * and to determine the natural ordering of {@code
127bbe13a6d36580af6a8ded154f1201a6250772tomee * KernelSymbolRecord} instances.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return non-null value of the symbol's kernel address
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Compares the specified object with this {@code KernelSymbolRecord}
127bbe13a6d36580af6a8ded154f1201a6250772tomee * for equality. Returns {@code true} if and only if the specified
127bbe13a6d36580af6a8ded154f1201a6250772tomee * object is also a {@code KernelSymbolRecord} and both records have
127bbe13a6d36580af6a8ded154f1201a6250772tomee * the same address.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return {@code true} if and only if the specified object is also
127bbe13a6d36580af6a8ded154f1201a6250772tomee * a {@code KernelSymbolRecord} and both records have the same
127bbe13a6d36580af6a8ded154f1201a6250772tomee public boolean
127bbe13a6d36580af6a8ded154f1201a6250772tomee if (o instanceof KernelSymbolRecord) {
127bbe13a6d36580af6a8ded154f1201a6250772tomee return false;
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Overridden to ensure that equal instances have equal hash codes.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Compares this record with the given kernel symbol lookup and
127bbe13a6d36580af6a8ded154f1201a6250772tomee * orders by address. The comparison treats addresses as unsigned
127bbe13a6d36580af6a8ded154f1201a6250772tomee * values so the ordering is consistent with that defined in the
127bbe13a6d36580af6a8ded154f1201a6250772tomee * native DTrace library. The {@code compareTo()} method is
127bbe13a6d36580af6a8ded154f1201a6250772tomee * compatible with {@link #equals(Object o) equals()}.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return -1, 0, or 1 as this record's address is less than, equal
127bbe13a6d36580af6a8ded154f1201a6250772tomee * to, or greater than the given record's address
127bbe13a6d36580af6a8ded154f1201a6250772tomee private void
127bbe13a6d36580af6a8ded154f1201a6250772tomee // check class invariants
127bbe13a6d36580af6a8ded154f1201a6250772tomee } catch (Exception e) {
4ae67516a1d5dc4a5dbc761762bad5b596647388tomee InvalidObjectException x = new InvalidObjectException(
127bbe13a6d36580af6a8ded154f1201a6250772tomee * Gets the result of this symbol lookup. The format is defined in
127bbe13a6d36580af6a8ded154f1201a6250772tomee * the native DTrace library and is as stable as that library
127bbe13a6d36580af6a8ded154f1201a6250772tomee * definition.
127bbe13a6d36580af6a8ded154f1201a6250772tomee * @return {@link #getSymbol()}