feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate line number or variable information is not available.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class AbsentInformationException extends Exception
{
private static final long serialVersionUID = 4988939309582416373L;
public AbsentInformationException()
{
super();
}
public AbsentInformationException(String s)
{
super(s);
}
}

View File

@@ -0,0 +1,108 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides information on the accessibility of a type or type component.
* Mirrors for program elements which allow an
* an access specifier (private, protected, public) provide information
* on that part of the declaration through this interface.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Accessible {
/**
* Returns the Java<sup><font size=-2>TM</font></sup>
* programming language modifiers, encoded in an integer.
* <p>
* The modifier encodings are defined in
* <cite>The Java&trade; Virtual Machine Specification</cite>
* in the <code>access_flag</code> tables for classes(section 4.1), fields(section 4.5), and methods(section 4.6).
*/
public int modifiers();
/**
* Determines if this object mirrors a private item.
* For {@link ArrayType}, the return value depends on the
* array component type. For primitive arrays the return value
* is always false. For object arrays, the return value is the
* same as would be returned for the component type.
* For primitive classes, such as {@link java.lang.Integer#TYPE},
* the return value is always false.
*
* @return <code>true</code> for items with private access;
* <code>false</code> otherwise.
*/
boolean isPrivate();
/**
* Determines if this object mirrors a package private item.
* A package private item is declared with no access specifier.
* For {@link ArrayType}, the return value depends on the
* array component type. For primitive arrays the return value
* is always false. For object arrays, the return value is the
* same as would be returned for the component type.
* For primitive classes, such as {@link java.lang.Integer#TYPE},
* the return value is always false.
*
* @return <code>true</code> for items with package private access;
* <code>false</code> otherwise.
*/
boolean isPackagePrivate();
/**
* Determines if this object mirrors a protected item.
* For {@link ArrayType}, the return value depends on the
* array component type. For primitive arrays the return value
* is always false. For object arrays, the return value is the
* same as would be returned for the component type.
* For primitive classes, such as {@link java.lang.Integer#TYPE},
* the return value is always false.
*
* @return <code>true</code> for items with private access;
* <code>false</code> otherwise.
*/
boolean isProtected();
/**
* Determines if this object mirrors a public item.
* For {@link ArrayType}, the return value depends on the
* array component type. For primitive arrays the return value
* is always true. For object arrays, the return value is the
* same as would be returned for the component type.
* For primitive classes, such as {@link java.lang.Integer#TYPE},
* the return value is always true.
*
* @return <code>true</code> for items with public access;
* <code>false</code> otherwise.
*/
boolean isPublic();
}

View File

@@ -0,0 +1,210 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* Provides access to an array object and its components in the target VM.
* Each array component is mirrored by a {@link Value} object.
* The array components, in aggregate, are placed in {@link java.util.List}
* objects instead of arrays for consistency with the rest of the API and
* for interoperability with other APIs.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ArrayReference extends ObjectReference {
/**
* Returns the number of components in this array.
*
* @return the integer count of components in this array.
*/
int length();
/**
* Returns an array component value.
*
* @param index the index of the component to retrieve
* @return the {@link Value} at the given index.
* @throws java.lang.IndexOutOfBoundsException if
* <CODE><I>index</I></CODE> is outside the range of this array,
* that is, if either of the following are true:
* <PRE>
* <I>index</I> &lt; 0
* <I>index</I> &gt;= {@link #length() length()} </PRE>
*/
Value getValue(int index);
/**
* Returns all of the components in this array.
*
* @return a list of {@link Value} objects, one for each array
* component ordered by array index. For zero length arrays,
* an empty list is returned.
*/
List<Value> getValues();
/**
* Returns a range of array components.
*
* @param index the index of the first component to retrieve
* @param length the number of components to retrieve, or -1 to
* retrieve all components to the end of this array.
* @return a list of {@link Value} objects, one for each requested
* array component ordered by array index. When there are
* no elements in the specified range (e.g.
* <CODE><I>length</I></CODE> is zero) an empty list is returned
*
* @throws java.lang.IndexOutOfBoundsException if the range
* specified with <CODE><I>index</I></CODE> and
* <CODE><I>length</I></CODE> is not within the range of the array,
* that is, if either of the following are true:
* <PRE>
* <I>index</I> &lt; 0
* <I>index</I> &gt; {@link #length() length()} </PRE>
* or if <CODE><I>length</I> != -1</CODE> and
* either of the following are true:
* <PRE>
* <I>length</I> &lt; 0
* <I>index</I> + <I>length</I> &gt; {@link #length() length()}</PRE>
*/
List<Value> getValues(int index, int length);
/**
* Replaces an array component with another value.
* <p>
* Object values must be assignment compatible with the component type
* (This implies that the component type must be loaded through the
* declaring class's class loader). Primitive values must be
* either assignment compatible with the component type or must be
* convertible to the component type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
*
* @param value the new value
* @param index the index of the component to set
* @throws java.lang.IndexOutOfBoundsException if
* <CODE><I>index</I></CODE> is outside the range of this array,
* that is, if either of the following are true:
* <PRE>
* <I>index</I> &lt; 0
* <I>index</I> &gt;= {@link #length() length()} </PRE>
* @throws InvalidTypeException if the type of <CODE><I>value</I></CODE>
* is not compatible with the declared type of array components.
* @throws ClassNotLoadedException if the array component type
* has not yet been loaded
* through the appropriate class loader.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @see ArrayType#componentType()
*/
void setValue(int index, Value value)
throws InvalidTypeException,
ClassNotLoadedException;
/**
* Replaces all array components with other values. If the given
* list is larger in size than the array, the values at the
* end of the list are ignored.
* <p>
* Object values must be assignment compatible with the element type
* (This implies that the component type must be loaded through the
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the component type or must be
* convertible to the component type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
*
* @param values a list of {@link Value} objects to be placed
* in this array. If <CODE><I>values</I>.size()</CODE> is
* less that the length of the array, the first
* <CODE><I>values</I>.size()</CODE> elements are set.
* @throws InvalidTypeException if any of the
* new <CODE><I>values</I></CODE>
* is not compatible with the declared type of array components.
* @throws ClassNotLoadedException if the array component
* type has not yet been loaded
* through the appropriate class loader.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @see ArrayType#componentType()
*/
void setValues(List<? extends Value> values)
throws InvalidTypeException,
ClassNotLoadedException;
/**
* Replaces a range of array components with other values.
* <p>
* Object values must be assignment compatible with the component type
* (This implies that the component type must be loaded through the
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the component type or must be
* convertible to the component type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
*
* @param index the index of the first component to set.
* @param values a list of {@link Value} objects to be placed
* in this array.
* @param srcIndex the index of the first source value to use.
* @param length the number of components to set, or -1 to set
* all components to the end of this array or the end of
* <CODE><I>values</I></CODE> (whichever comes first).
* @throws InvalidTypeException if any element of
* <CODE><I>values</I></CODE>
* is not compatible with the declared type of array components.
* @throws java.lang.IndexOutOfBoundsException if the
* array range specified with
* <CODE><I>index</I></CODE> and <CODE><I>length</I></CODE>
* is not within the range of the array,
* or if the source range specified with
* <CODE><I>srcIndex</I></CODE> and <CODE><I>length</I></CODE>
* is not within <CODE><I>values</I></CODE>,
* that is, if any of the following are true:
* <PRE>
* <I>index</I> &lt; 0
* <I>index</I> &gt; {@link #length() length()}
* <I>srcIndex</I> &lt; 0
* <I>srcIndex</I> &gt; <I>values</I>.size() </PRE>
* or if <CODE><I>length</I> != -1</CODE> and any of the
* following are true:
* <PRE>
* <I>length</I> &lt; 0
* <I>index</I> + <I>length</I> &gt; {@link #length() length()}
* <I>srcIndex</I> + <I>length</I> &gt; <I>values</I>.size() </PRE>
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
* @see ArrayType#componentType()
*/
void setValues(int index, List<? extends Value> values, int srcIndex, int length)
throws InvalidTypeException,
ClassNotLoadedException;
}

View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* Provides access to the class of an array and the type of
* its components in the target VM.
*
* @see ArrayReference
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ArrayType extends ReferenceType {
/**
* Creates a new instance of this array class in the target VM.
* The array is created with the given length and each component
* is initialized to is standard default value.
*
* @param length the number of components in the new array
* @return the newly created {@link ArrayReference} mirroring
* the new object in the target VM.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
ArrayReference newInstance(int length);
/**
* Gets the JNI signature of the components of this
* array class. The signature
* describes the declared type of the components. If the components
* are objects, their actual type in a particular run-time context
* may be a subclass of the declared class.
*
* @return a string containing the JNI signature of array components.
*/
String componentSignature();
/**
* Returns a text representation of the component
* type of this array.
*
* @return a text representation of the component type.
*/
String componentTypeName();
/**
* Returns the component type of this array,
* as specified in the array declaration.
* <P>
* Note: The component type of a array will always be
* created or loaded before the array - see
* <cite>The Java&trade; Virtual Machine Specification</cite>,
* section 5.3.3 - Creating Array Classes.
* However, although the component type will be loaded it may
* not yet be prepared, in which case the type will be returned
* but attempts to perform some operations on the returned type
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @see Type
* @see Field#type() Field.type() - for usage examples
* @return the {@link Type} of this array's components.
*/
Type componentType() throws ClassNotLoadedException;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive <code>boolean</code> values
* accessed in the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see BooleanValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface BooleanType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>boolean</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface BooleanValue extends PrimitiveValue {
/**
* Returns this BooleanValue as a boolean.
*
* @return the <code>boolean</code> mirrored by this object.
*/
boolean value();
/**
* Compares the specified Object with this BooleanValue for equality.
*
* @return true if the Object is a BooleanValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this BooleanValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Initial class that provides access to the default implementation
* of JDI interfaces. A debugger application uses this class to access the
* single instance of the {@link VirtualMachineManager} interface.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class Bootstrap extends Object {
/**
* Returns the virtual machine manager.
*
* <p> May throw an unspecified error if initialization of the
* {@link com.sun.jdi.VirtualMachineManager} fails or if
* the virtual machine manager is unable to locate or create
* any {@link com.sun.jdi.connect.Connector Connectors}. </p>
* <p>
* @throws java.lang.SecurityException if a security manager has been
* installed and it denies {@link JDIPermission}
* <tt>("virtualMachineManager")</tt> or other unspecified
* permissions required by the implementation.
* </p>
*/
static public synchronized VirtualMachineManager virtualMachineManager() {
return com.sun.tools.jdi.VirtualMachineManagerImpl.virtualMachineManager();
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive byte values accessed in
* the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see ByteValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ByteType extends PrimitiveType {
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>byte</code> value in the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ByteValue extends PrimitiveValue, Comparable<ByteValue> {
/**
* Returns this ByteValue as a <code>byte</code>.
*
* @return the <code>byte</code> mirrored by this object.
*/
byte value();
/**
* Compares the specified Object with this ByteValue for equality.
*
* @return true if the Object is a ByteValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this BooleanValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive char values accessed in
* the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see CharValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface CharType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>char</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface CharValue extends PrimitiveValue, Comparable<CharValue> {
/**
* Returns this CharValue as a <code>char</code>.
*
* @return the <code>char</code> mirrored by this object.
*/
char value();
/**
* Compares the specified Object with this CharValue for equality.
*
* @return true if the Object is a CharValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this CharValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A class loader object from the target VM.
* A ClassLoaderReference is an {@link ObjectReference} with additional
* access to classloader-specific information from the target VM. Instances
* ClassLoaderReference are obtained through calls to
* {@link ReferenceType#classLoader}
*
* @see ObjectReference
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface ClassLoaderReference extends ObjectReference {
/**
* Returns a list of all loaded classes that were defined by this
* class loader. No ordering of this list guaranteed.
* <P>
* The returned list will include reference types
* loaded at least to the point of preparation and
* types (like array) for which preparation is
* not defined.
*
* @return a List of {@link ReferenceType} objects mirroring types
* loaded by this class loader. The list has length 0 if no types
* have been defined by this classloader.
*/
List<ReferenceType> definedClasses();
/**
* Returns a list of all classes for which this class loader has
* been recorded as the initiating loader in the target VM.
* The list contains ReferenceTypes defined directly by this loader
* (as returned by {@link #definedClasses}) and any types for which
* loading was delegated by this class loader to another class loader.
* <p>
* The visible class list has useful properties with respect to
* the type namespace. A particular type name will occur at most
* once in the list. Each field or variable declared with that
* type name in a class defined by
* this class loader must be resolved to that single type.
* <p>
* No ordering of the returned list is guaranteed.
* <p>
* See
* <cite>The Java&trade; Virtual Machine Specification</cite>,
* section 5.3 - Creation and Loading
* for more information on the initiating classloader.
* <p>
* Note that unlike {@link #definedClasses()}
* and {@link VirtualMachine#allClasses()},
* some of the returned reference types may not be prepared.
* Attempts to perform some operations on unprepared reference types
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @return a List of {@link ReferenceType} objects mirroring classes
* initiated by this class loader. The list has length 0 if no classes
* are visible to this classloader.
*/
List<ReferenceType> visibleClasses();
}

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested class has
* not yet been loaded through the appropriate class loader.
* <p>
* Due to the lazy class linking performed by many VMs, it is
* possible for a field or variable to be visible in a program
* before the associated class is loaded. Until the class is loaded
* all that is available is a signature string. If an attempt is made to
* set the value of such a field or variable from JDI, the appropriate
* type checking cannot be done because the destination class has not been
* loaded. The same is true for the element class of array elements.
* <p>
* It is not advisable to solve this problem by attempting a class load on
* the fly in this case. There are two problems in having the debugger load
* a class instead of waiting for it to load over the normal course
* of events.
* <ul>
* <li>There can be no guarantee that running the appropriate class
* loader won't cause a deadlock in loading the
* class. Class loaders can consist of arbitrary
* Java<sup><font size=-2>TM</font></sup> programming language code and the
* class loading methods are usually synchronized. Most of the work
* done by a debugger happens when threads are suspended. If another
* application thread is suspended within the same class loader,
* a deadlock is very possible.
* <li>Changing the order in which classes are normally loaded may either mask
* or reveal bugs in the application. An unintrusive debugger should strive
* to leave unchanged the behavior of the application being debugged.
* </ul>
* To avoid these potential problems, this exception is thrown.
* <p>
* Note that this exception will be thrown until the class in question
* is visible to the class loader of enclosing class. (That is, the
* class loader of the enclosing class must be an <i>initiating</i> class
* loader for the class in question.)
* See
* <cite>The Java&trade; Virtual Machine Specification</cite>
* for more details.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class ClassNotLoadedException extends Exception
{
private static final long serialVersionUID = -6242978768444298722L;
private String className;
public ClassNotLoadedException(String className) {
super();
this.className = className;
}
public ClassNotLoadedException(String className, String message) {
super(message);
this.className = className;
}
public String className() {
return className;
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the specified class has not yet been prepared.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class ClassNotPreparedException extends RuntimeException {
private static final long serialVersionUID = -6120698967144079642L;
public ClassNotPreparedException()
{
super();
}
public ClassNotPreparedException(String s)
{
super(s);
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* An instance of java.lang.Class from the target VM.
* Use this interface to access type information
* for the class, array, or interface that this object reflects.
*
* @see ReferenceType
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface ClassObjectReference extends ObjectReference {
/**
* Returns the {@link ReferenceType} corresponding to this
* class object. The returned type can be used to obtain
* detailed information about the class.
*
* @return the {@link ReferenceType} reflected by this class object.
*/
ReferenceType reflectedType();
}

View File

@@ -0,0 +1,373 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A mirror of a class in the target VM. A ClassType is a refinement
* of {@link ReferenceType} that applies to true classes in the JLS
* sense of the definition (not an interface, not an array type). Any
* {@link ObjectReference} that mirrors an instance of such a class
* will have a ClassType as its type.
*
* @see ObjectReference
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ClassType extends ReferenceType {
/**
* Gets the superclass of this class.
*
* @return a {@link ClassType} that mirrors the superclass
* of this class in the target VM. If no such class exists,
* returns null
*/
ClassType superclass();
/**
* Gets the interfaces directly implemented by this class.
* Only the interfaces that are declared with the "implements"
* keyword in this class are included.
*
* @return a List of {@link InterfaceType} objects each mirroring
* a direct interface this ClassType in the target VM.
* If none exist, returns a zero length List.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<InterfaceType> interfaces();
/**
* Gets the interfaces directly and indirectly implemented
* by this class. Interfaces returned by {@link ClassType#interfaces}
* are returned as well all superinterfaces.
*
* @return a List of {@link InterfaceType} objects each mirroring
* an interface of this ClassType in the target VM.
* If none exist, returns a zero length List.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<InterfaceType> allInterfaces();
/**
* Gets the currently loaded, direct subclasses of this class.
* No ordering of this list is guaranteed.
*
* @return a List of {@link ClassType} objects each mirroring a loaded
* subclass of this class in the target VM. If no such classes
* exist, this method returns a zero-length list.
*/
List<ClassType> subclasses();
/**
* Determine if this class was declared as an enum.
* @return <code>true</code> if this class was declared as an enum; false
* otherwise.
*/
boolean isEnum();
/**
* Assigns a value to a static field.
* The {@link Field} must be valid for this ClassType; that is,
* it must be from the mirrored object's class or a superclass of that class.
* The field must not be final.
* <p>
* Object values must be assignment compatible with the field type
* (This implies that the field type must be loaded through the
* enclosing class' class loader). Primitive values must be
* either assignment compatible with the field type or must be
* convertible to the field type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
*
* @param field the field to set.
* @param value the value to be assigned.
* @throws java.lang.IllegalArgumentException if the field is
* not static, the field is final, or the field does not exist
* in this class.
* @throws ClassNotLoadedException if the field type has not yet been loaded
* through the appropriate class loader.
* @throws InvalidTypeException if the value's type does not match
* the field's declared type.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void setValue(Field field, Value value)
throws InvalidTypeException, ClassNotLoadedException;
/** Perform method invocation with only the invoking thread resumed */
static final int INVOKE_SINGLE_THREADED = 0x1;
/**
* Invokes the specified static {@link Method} in the
* target VM. The
* specified method can be defined in this class,
* or in a superclass.
* The method must be a static method
* but not a static initializer.
* Use {@link ClassType#newInstance} to create a new object and
* run its constructor.
* <p>
* The method invocation will occur in the specified thread.
* Method invocation can occur only if the specified thread
* has been suspended by an event which occurred in that thread.
* Method invocation is not supported
* when the target VM has been suspended through
* {@link VirtualMachine#suspend} or when the specified thread
* is suspended through {@link ThreadReference#suspend}.
* <p>
* The specified method is invoked with the arguments in the specified
* argument list. The method invocation is synchronous; this method
* does not return until the invoked method returns in the target VM.
* If the invoked method throws an exception, this method will throw
* an {@link InvocationException} which contains a mirror to the exception
* object thrown.
* <p>
* Object arguments must be assignment compatible with the argument type
* (This implies that the argument type must be loaded through the
* enclosing class' class loader). Primitive arguments must be
* either assignment compatible with the argument type or must be
* convertible to the argument type without loss of information.
* If the method being called accepts a variable number of arguments,
* then the last argument type is an array of some component type.
* The argument in the matching position can be omitted, or can be null,
* an array of the same component type, or an argument of the
* component type followed by any number of other arguments of the same
* type. If the argument is omitted, then a 0 length array of the
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See Section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, all threads in the target VM are resumed while
* the method is being invoked if they were previously
* suspended by an event or by {@link VirtualMachine#suspend} or
* {@link ThreadReference#suspend}. This is done to prevent the deadlocks
* that will occur if any of the threads own monitors
* that will be needed by the invoked method.
* Note, however, that this implicit resume acts exactly like
* {@link ThreadReference#resume}, so if the thread's suspend
* count is greater than 1, it will remain in a suspended state
* during the invocation and thus a deadlock could still occur.
* By default, when the invocation completes,
* all threads in the target VM are suspended, regardless their state
* before the invocation.
* It is possible that
* breakpoints or other events might occur during the invocation.
* This can cause deadlocks as described above. It can also cause a deadlock
* if invokeMethod is called from the client's event handler thread. In this
* case, this thread will be waiting for the invokeMethod to complete and
* won't read the EventSet that comes in for the new event. If this
* new EventSet is SUSPEND_ALL, then a deadlock will occur because no
* one will resume the EventSet. To avoid this, all EventRequests should
* be disabled before doing the invokeMethod, or the invokeMethod should
* not be done from the client's event handler thread.
* <p>
* The resumption of other threads during the invocation can be prevented
* by specifying the {@link #INVOKE_SINGLE_THREADED}
* bit flag in the <code>options</code> argument; however,
* there is no protection against or recovery from the deadlocks
* described above, so this option should be used with great caution.
* Only the specified thread will be resumed (as described for all
* threads above). Upon completion of a single threaded invoke, the invoking thread
* will be suspended once again. Note that any threads started during
* the single threaded invocation will not be suspended when the
* invocation completes.
* <p>
* If the target VM is disconnected during the invoke (for example, through
* {@link VirtualMachine#dispose}) the method invocation continues.
*
* @param thread the thread in which to invoke.
* @param method the {@link Method} to invoke.
* @param arguments the list of {@link Value} arguments bound to the
* invoked method. Values from the list are assigned to arguments
* in the order they appear in the method signature.
* @param options the integer bit flag options.
* @return a {@link Value} mirror of the invoked method's return value.
* @throws java.lang.IllegalArgumentException if the method is not
* a member of this class or a superclass, if the size of the argument list
* does not match the number of declared arguments for the method, or
* if the method is an initializer, constructor or static intializer.
* @throws {@link InvalidTypeException} if any argument in the
* argument list is not assignable to the corresponding method argument
* type.
* @throws ClassNotLoadedException if any argument type has not yet been loaded
* through the appropriate class loader.
* @throws IncompatibleThreadStateException if the specified thread has not
* been suspended by an event.
* @throws InvocationException if the method invocation resulted in
* an exception in the target VM.
* @throws InvalidTypeException If the arguments do not meet this requirement --
* Object arguments must be assignment compatible with the argument
* type. This implies that the argument type must be
* loaded through the enclosing class' class loader.
* Primitive arguments must be either assignment compatible with the
* argument type or must be convertible to the argument type without loss
* of information. See JLS section 5.2 for more information on assignment
* compatibility.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
Value invokeMethod(ThreadReference thread, Method method,
List<? extends Value> arguments, int options)
throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException;
/**
* Constructs a new instance of this type, using
* the given constructor {@link Method} in the
* target VM. The
* specified constructor must be defined in this class.
* <p>
* Instance creation will occur in the specified thread.
* Instance creation can occur only if the specified thread
* has been suspended by an event which occurred in that thread.
* Instance creation is not supported
* when the target VM has been suspended through
* {@link VirtualMachine#suspend} or when the specified thread
* is suspended through {@link ThreadReference#suspend}.
* <p>
* The specified constructor is invoked with the arguments in the specified
* argument list. The invocation is synchronous; this method
* does not return until the constructor returns in the target VM.
* If the invoked method throws an
* exception, this method will throw an {@link InvocationException}
* which contains a mirror to the exception object thrown.
* <p>
* Object arguments must be assignment compatible with the argument type
* (This implies that the argument type must be loaded through the
* enclosing class' class loader). Primitive arguments must be
* either assignment compatible with the argument type or must be
* convertible to the argument type without loss of information.
* If the method being called accepts a variable number of arguments,
* then the last argument type is an array of some component type.
* The argument in the matching position can be omitted, or can be null,
* an array of the same component type, or an argument of the
* component type, followed by any number of other arguments of the same
* type. If the argument is omitted, then a 0 length array of the
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, all threads in the target VM are resumed while
* the method is being invoked if they were previously
* suspended by an event or by {@link VirtualMachine#suspend} or
* {@link ThreadReference#suspend}. This is done to prevent the deadlocks
* that will occur if any of the threads own monitors
* that will be needed by the invoked method. It is possible that
* breakpoints or other events might occur during the invocation.
* Note, however, that this implicit resume acts exactly like
* {@link ThreadReference#resume}, so if the thread's suspend
* count is greater than 1, it will remain in a suspended state
* during the invocation. By default, when the invocation completes,
* all threads in the target VM are suspended, regardless their state
* before the invocation.
* <p>
* The resumption of other threads during the invocation can be prevented
* by specifying the {@link #INVOKE_SINGLE_THREADED}
* bit flag in the <code>options</code> argument; however,
* there is no protection against or recovery from the deadlocks
* described above, so this option should be used with great caution.
* Only the specified thread will be resumed (as described for all
* threads above). Upon completion of a single threaded invoke, the invoking thread
* will be suspended once again. Note that any threads started during
* the single threaded invocation will not be suspended when the
* invocation completes.
* <p>
* If the target VM is disconnected during the invoke (for example, through
* {@link VirtualMachine#dispose}) the method invocation continues.
*
* @param thread the thread in which to invoke.
* @param method the constructor {@link Method} to invoke.
* @param arguments the list of {@link Value} arguments bound to the
* invoked constructor. Values from the list are assigned to arguments
* in the order they appear in the constructor signature.
* @param options the integer bit flag options.
* @return an {@link ObjectReference} mirror of the newly created
* object.
* @throws java.lang.IllegalArgumentException if the method is not
* a member of this class, if the size of the argument list
* does not match the number of declared arguments for the constructor,
* or if the method is not a constructor.
* @throws {@link InvalidTypeException} if any argument in the
* argument list is not assignable to the corresponding method argument
* type.
* @throws ClassNotLoadedException if any argument type has not yet been loaded
* through the appropriate class loader.
* @throws IncompatibleThreadStateException if the specified thread has not
* been suspended by an event.
* @throws InvocationException if the method invocation resulted in
* an exception in the target VM.
* @throws InvalidTypeException If the arguments do not meet this requirement --
* Object arguments must be assignment compatible with the argument
* type. This implies that the argument type must be
* loaded through the enclosing class' class loader.
* Primitive arguments must be either assignment compatible with the
* argument type or must be convertible to the argument type without loss
* of information. See JLS section 5.2 for more information on assignment
* compatibility.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* - see {@link VirtualMachine#canBeModified()}.
*/
ObjectReference newInstance(ThreadReference thread, Method method,
List<? extends Value> arguments, int options)
throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException;
/**
* Returns a the single non-abstract {@link Method} visible from
* this class that has the given name and signature.
* See {@link ReferenceType#methodsByName(java.lang.String, java.lang.String)}
* for information on signature format.
* <p>
* The returned method (if non-null) is a component of
* {@link ClassType}.
*
* @see ReferenceType#visibleMethods
* @see ReferenceType#methodsByName(java.lang.String name)
* @see ReferenceType#methodsByName(java.lang.String name, java.lang.String signature)
* @param name the name of the method to find.
* @param signature the signature of the method to find
* @return the {@link Method} that matches the given
* name and signature or <code>null</code> if there is no match.
* @throws ClassNotPreparedException if methods are not yet available
* because the class has not yet been prepared.
*/
Method concreteMethodByName(String name, String signature);
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive double values accessed in
* the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see DoubleValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface DoubleType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>double</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface DoubleValue extends PrimitiveValue, Comparable<DoubleValue> {
/**
* Returns this DoubleValue as a <code>double</code>.
*
* @return the <code>double</code> mirrored by this object.
*/
double value();
/**
* Compares the specified Object with this DoubleValue for equality.
*
* @return true if the Object is a DoubleValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this DoubleValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,136 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* A class or instance variable in the target VM.
* See {@link TypeComponent}
* for general information about Field and Method mirrors.
*
* @see ObjectReference
* @see ReferenceType
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Field extends TypeComponent, Comparable<Field> {
/**
* Returns a text representation of the type
* of this field.
* Where the type is the type specified in the declaration
* of this field.
* <P>
* This type name is always available even if
* the type has not yet been created or loaded.
*
* @return a String representing the
* type of this field.
*/
String typeName();
/**
* Returns the type of this field.
* Where the type is the type specified in the declaration
* of this field.
* <P>
* For example, if a target class defines:
* <PRE>
* short s;
* Date d;
* byte[] ba;</PRE>
* And the JDI client defines these <CODE>Field</CODE> objects:
* <PRE>
* Field sField = targetClass.fieldByName("s");
* Field dField = targetClass.fieldByName("d");
* Field baField = targetClass.fieldByName("ba");</PRE>
* to mirror the corresponding fields, then <CODE>sField.type()</CODE>
* is a {@link ShortType}, <CODE>dField.type()</CODE> is the
* {@link ReferenceType} for <CODE>java.util.Date</CODE> and
* <CODE>((ArrayType)(baField.type())).componentType()</CODE> is a
* {@link ByteType}.
* <P>
* Note: if the type of this field is a reference type (class,
* interface, or array) and it has not been created or loaded
* by the declaring type's class loader - that is,
* {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
* <CODE>.classLoader()</CODE>,
* then ClassNotLoadedException will be thrown.
* Also, a reference type may have been loaded but not yet prepared,
* in which case the type will be returned
* but attempts to perform some operations on the returned type
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @see Type
* @return the {@link Type} of this field.
* @throws ClassNotLoadedException if the type has not yet been loaded
* or created through the appropriate class loader.
*/
Type type() throws ClassNotLoadedException;
/**
* Determine if this is a transient field.
*
* @return <code>true</code> if this field is transient; false otherwise.
*/
boolean isTransient();
/**
* Determine if this is a volatile field.
*
* @return <code>true</code> if this field is volatile; false otherwise.
*/
boolean isVolatile();
/**
* Determine if this is a field that represents an enum constant.
* @return <code>true</code> if this field represents an enum constant;
* false otherwise.
*/
boolean isEnumConstant();
/**
* Compares the specified Object with this field for equality.
*
* @return true if the Object is a Field and if both
* mirror the same field (declared in the same class or interface, in
* the same VM).
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this Field.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive float values accessed in
* the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see FloatValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface FloatType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>float</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface FloatValue extends PrimitiveValue, Comparable<FloatValue> {
/**
* Returns this FloatValue as a float.
*
* @return the <code>float</code> mirrored by this object.
*/
float value();
/**
* Compares the specified Object with this FloatValue for equality.
*
* @return true if the Object is a FloatValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this FloatValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed while the specified thread is in its current state.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class IncompatibleThreadStateException extends Exception {
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException() {
super();
}
public IncompatibleThreadStateException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that there is an inconistency in the debug
* information provided by the target VM. For example, this exception
* is thrown if there is a type mismatch between a retrieved value's
* runtime type and its declared type as reported by the target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class InconsistentDebugInfoException extends RuntimeException {
private static final long serialVersionUID = 7964236415376861808L;
public InconsistentDebugInfoException() {
super();
}
public InconsistentDebugInfoException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive <code>int</code> values
* accessed in the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see IntegerValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface IntegerType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>int</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface IntegerValue extends PrimitiveValue, Comparable<IntegerValue> {
/**
* Returns this IntegerValue as an int.
*
* @return the <code>int</code> mirrored by this object.
*/
int value();
/**
* Compares the specified Object with this IntegerValue for equality.
*
* @return true if the Object is an IntegerValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this IntegerValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,201 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A mirror of an interface in the target VM. An InterfaceType is
* a refinement of {@link ReferenceType} that applies to true interfaces
* in the JLS sense of the definition (not a class, not an array type).
* An interface type will never be returned by
* {@link ObjectReference#referenceType}, but it may be in the list
* of implemented interfaces for a {@link ClassType} that is returned
* by that method.
*
* @see ObjectReference
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface InterfaceType extends ReferenceType {
/**
* Gets the interfaces directly extended by this interface.
* The returned list contains only those interfaces this
* interface has declared to be extended.
*
* @return a List of {@link InterfaceType} objects each mirroring
* an interface extended by this interface.
* If none exist, returns a zero length List.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<InterfaceType> superinterfaces();
/**
* Gets the currently prepared interfaces which directly extend this
* interface. The returned list contains only those interfaces that
* declared this interface in their "extends" clause.
*
* @return a List of {@link InterfaceType} objects each mirroring
* an interface extending this interface.
* If none exist, returns a zero length List.
*/
List<InterfaceType> subinterfaces();
/**
* Gets the currently prepared classes which directly implement this
* interface. The returned list contains only those classes that
* declared this interface in their "implements" clause.
*
* @return a List of {@link ClassType} objects each mirroring
* a class implementing this interface.
* If none exist, returns a zero length List.
*/
List<ClassType> implementors();
/**
* Invokes the specified static {@link Method} in the
* target VM. The
* specified method must be defined in this interface.
* The method must be a static method
* but not a static initializer.
* <p>
* The method invocation will occur in the specified thread.
* Method invocation can occur only if the specified thread
* has been suspended by an event which occurred in that thread.
* Method invocation is not supported
* when the target VM has been suspended through
* {@link VirtualMachine#suspend} or when the specified thread
* is suspended through {@link ThreadReference#suspend}.
* <p>
* The specified method is invoked with the arguments in the specified
* argument list. The method invocation is synchronous; this method
* does not return until the invoked method returns in the target VM.
* If the invoked method throws an exception, this method will throw
* an {@link InvocationException} which contains a mirror to the exception
* object thrown.
* <p>
* Object arguments must be assignment compatible with the argument type
* (This implies that the argument type must be loaded through the
* enclosing class' class loader). Primitive arguments must be
* either assignment compatible with the argument type or must be
* convertible to the argument type without loss of information.
* If the method being called accepts a variable number of arguments,
* then the last argument type is an array of some component type.
* The argument in the matching position can be omitted, or can be null,
* an array of the same component type, or an argument of the
* component type followed by any number of other arguments of the same
* type. If the argument is omitted, then a 0 length array of the
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See Section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, all threads in the target VM are resumed while
* the method is being invoked if they were previously
* suspended by an event or by {@link VirtualMachine#suspend} or
* {@link ThreadReference#suspend}. This is done to prevent the deadlocks
* that will occur if any of the threads own monitors
* that will be needed by the invoked method.
* Note, however, that this implicit resume acts exactly like
* {@link ThreadReference#resume}, so if the thread's suspend
* count is greater than 1, it will remain in a suspended state
* during the invocation and thus a deadlock could still occur.
* By default, when the invocation completes,
* all threads in the target VM are suspended, regardless their state
* before the invocation.
* It is possible that
* breakpoints or other events might occur during the invocation.
* This can cause deadlocks as described above. It can also cause a deadlock
* if invokeMethod is called from the client's event handler thread. In this
* case, this thread will be waiting for the invokeMethod to complete and
* won't read the EventSet that comes in for the new event. If this
* new EventSet is SUSPEND_ALL, then a deadlock will occur because no
* one will resume the EventSet. To avoid this, all EventRequests should
* be disabled before doing the invokeMethod, or the invokeMethod should
* not be done from the client's event handler thread.
* <p>
* The resumption of other threads during the invocation can be prevented
* by specifying the {@link #INVOKE_SINGLE_THREADED}
* bit flag in the <code>options</code> argument; however,
* there is no protection against or recovery from the deadlocks
* described above, so this option should be used with great caution.
* Only the specified thread will be resumed (as described for all
* threads above). Upon completion of a single threaded invoke, the invoking thread
* will be suspended once again. Note that any threads started during
* the single threaded invocation will not be suspended when the
* invocation completes.
* <p>
* If the target VM is disconnected during the invoke (for example, through
* {@link VirtualMachine#dispose}) the method invocation continues.
*
* @param thread the thread in which to invoke.
* @param method the {@link Method} to invoke.
* @param arguments the list of {@link Value} arguments bound to the
* invoked method. Values from the list are assigned to arguments
* in the order they appear in the method signature.
* @param options the integer bit flag options.
* @return a {@link Value} mirror of the invoked method's return value.
* @throws java.lang.IllegalArgumentException if the method is not
* a member of this interface, if the size of the argument list
* does not match the number of declared arguments for the method, or
* if the method is not static or is a static initializer.
* @throws {@link InvalidTypeException} if any argument in the
* argument list is not assignable to the corresponding method argument
* type.
* @throws ClassNotLoadedException if any argument type has not yet been loaded
* through the appropriate class loader.
* @throws IncompatibleThreadStateException if the specified thread has not
* been suspended by an event.
* @throws InvocationException if the method invocation resulted in
* an exception in the target VM.
* @throws InvalidTypeException If the arguments do not meet this requirement --
* Object arguments must be assignment compatible with the argument
* type. This implies that the argument type must be
* loaded through the enclosing class' class loader.
* Primitive arguments must be either assignment compatible with the
* argument type or must be convertible to the argument type without loss
* of information. See JLS section 5.2 for more information on assignment
* compatibility.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @since 1.8
*/
default Value invokeMethod(ThreadReference thread, Method method,
List<? extends Value> arguments, int options)
throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that an unexpected internal error has
* occurred.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class InternalException extends RuntimeException {
private static final long serialVersionUID = -9171606393104480607L;
private int errorCode;
public InternalException() {
super();
this.errorCode = 0;
}
public InternalException(String s) {
super(s);
this.errorCode = 0;
}
public InternalException(int errorCode) {
super();
this.errorCode = errorCode;
}
public InternalException(String s, int errorCode) {
super(s);
this.errorCode = errorCode;
}
public int errorCode() {
return errorCode;
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the specified code index is not valid.
*
* @deprecated This exception is no longer thrown
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
@Deprecated
public class InvalidCodeIndexException extends RuntimeException {
private static final long serialVersionUID = 7416010225133747805L;
public InvalidCodeIndexException() {
super();
}
public InvalidCodeIndexException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the specified line number is not valid.
*
* @deprecated This exception is no longer thrown
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
@Deprecated
public class InvalidLineNumberException extends RuntimeException {
private static final long serialVersionUID = 4048709912372692875L;
public InvalidLineNumberException() {
super();
}
public InvalidLineNumberException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the specified stack frame is no longer valid.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class InvalidStackFrameException extends RuntimeException {
private static final long serialVersionUID = -1919378296505827922L;
public InvalidStackFrameException() {
super();
}
public InvalidStackFrameException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate a type mismatch in setting the value of a field
* or variable, or in specifying the return value of a method.
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public class InvalidTypeException extends Exception {
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException() {
super();
}
public InvalidTypeException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate an exception occurred in an invoked method within
* the target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class InvocationException extends Exception {
private static final long serialVersionUID = 6066780907971918568L;
ObjectReference exception;
public InvocationException(ObjectReference exception) {
super("Exception occurred in target VM");
this.exception = exception;
}
public ObjectReference exception() {
return exception;
}
}

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The <code>JDIPermission</code> class represents access rights to
* the <code>VirtualMachineManager</code>. This is the permission
* which the SecurityManager will check when code that is running with
* a SecurityManager requests access to the VirtualMachineManager, as
* defined in the Java Debug Interface (JDI) for the Java platform.
* <P>
* A <code>JDIPermission</code> object contains a name (also referred
* to as a "target name") but no actions list; you either have the
* named permission or you don't.
* <P>
* The following table provides a summary description of what the
* permission allows, and discusses the risks of granting code the
* permission.
* <P>
* <table border=1 cellpadding=5 summary="Table shows permission
* target name, what the permission allows, and associated risks">
* <tr>
* <th>Permission Target Name</th>
* <th>What the Permission Allows</th>
* <th>Risks of Allowing this Permission</th>
* </tr>
*
* <tr>
* <td>virtualMachineManager</td>
* <td>Ability to inspect and modify the JDI objects in the
* <code>VirtualMachineManager</code>
* </td>
* <td>This allows an attacker to control the
* <code>VirtualMachineManager</code> and cause the system to
* misbehave.
* </td>
* </tr>
*
* </table>
*
* <p>
* Programmers do not normally create JDIPermission objects directly.
* Instead they are created by the security policy code based on reading
* the security policy file.
*
* @author Tim Bell
* @since 1.5
*
* @see com.sun.jdi.Bootstrap
* @see java.security.BasicPermission
* @see java.security.Permission
* @see java.security.Permissions
* @see java.security.PermissionCollection
* @see java.lang.SecurityManager
*
*/
@jdk.Exported
public final class JDIPermission extends java.security.BasicPermission {
private static final long serialVersionUID = -6988461416938786271L;
/**
* The <code>JDIPermission</code> class represents access rights to the
* <code>VirtualMachineManager</code>
* @param name Permission name. Must be "virtualMachineManager".
* @throws IllegalArgumentException if the name argument is invalid.
*/
public JDIPermission(String name) {
super(name);
if (!name.equals("virtualMachineManager")) {
throw new IllegalArgumentException("name: " + name);
}
}
/**
* Constructs a new JDIPermission object.
*
* @param name Permission name. Must be "virtualMachineManager".
* @param actions Must be either null or the empty string.
* @throws IllegalArgumentException if arguments are invalid.
*/
public JDIPermission(String name, String actions)
throws IllegalArgumentException {
super(name);
if (!name.equals("virtualMachineManager")) {
throw new IllegalArgumentException("name: " + name);
}
if (actions != null && actions.length() > 0) {
throw new IllegalArgumentException("actions: " + actions);
}
}
}

View File

@@ -0,0 +1,154 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* A local variable in the target VM. Each variable declared within a
* {@link Method} has its own LocalVariable object. Variables of the same
* name declared in different scopes have different LocalVariable objects.
* LocalVariables can be used alone to retrieve static information
* about their declaration, or can be used in conjunction with a
* {@link StackFrame} to set and get values.
*
* @see StackFrame
* @see Method
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface LocalVariable extends Mirror, Comparable<LocalVariable> {
/**
* Gets the name of the local variable.
*
* @return a string containing the name.
*/
String name();
/**
* Returns a text representation of the type
* of this variable.
* Where the type is the type specified in the declaration
* of this local variable.
* <P>
* This type name is always available even if
* the type has not yet been created or loaded.
*
* @return a String representing the
* type of this local variable.
*/
String typeName();
/**
* Returns the type of this variable.
* Where the type is the type specified in the declaration
* of this local variable.
* <P>
* Note: if the type of this variable is a reference type (class,
* interface, or array) and it has not been created or loaded
* by the class loader of the enclosing class,
* then ClassNotLoadedException will be thrown.
* Also, a reference type may have been loaded but not yet prepared,
* in which case the type will be returned
* but attempts to perform some operations on the returned type
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @see Type
* @see Field#type() Field.type() - for usage examples
* @return the {@link Type} of this local variable.
* @throws ClassNotLoadedException if the type has not yet been loaded
* through the appropriate class loader.
*/
Type type() throws ClassNotLoadedException;
/**
* Gets the JNI signature of the local variable.
*
* @see <a href="doc-files/signature.html">Type Signatures</a>
* @return a string containing the signature.
*/
String signature();
/**
* Gets the generic signature for this variable if there is one.
* Generic signatures are described in the
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.
*
* @since 1.5
*/
String genericSignature();
/**
* Determines whether this variable can be accessed from the given
* {@link StackFrame}.
*
* See {@link StackFrame#visibleVariables} for a complete description
* variable visibility in this interface.
*
* @param frame the StackFrame querying visibility
* @return <code>true</code> if this variable is visible;
* <code>false</code> otherwise.
* @throws IllegalArgumentException if the stack frame's method
* does not match this variable's method.
*/
boolean isVisible(StackFrame frame);
/**
* Determines if this variable is an argument to its method.
*
* @return <code>true</code> if this variable is an argument;
* <code>false</code> otherwise.
*/
boolean isArgument();
/**
* Compares the specified Object with this LocalVariable for equality.
*
* @return true if the Object is a LocalVariable, if both LocalVariables
* are contained in the same method (as determined by
* {@link Method#equals}), and if both LocalVariables mirror
* the same declaration within that method
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this LocalVariable.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* A mirror that has a {@link Location}.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Locatable {
/**
* Returns the {@link Location} of this mirror, if there
* is executable code associated with it. Note that both
* Java<SUP><FONT SIZE="-2">TM</FONT></SUP> programming
* language methods and native methods have executable code.
* Returns null for abstract methods, since abstract methods
* have no executable code.
*
* @return the {@link Location} of this mirror, or null if
* there is no executable code associated with it.
*/
Location location();
}

View File

@@ -0,0 +1,262 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A point within the executing code of the target VM.
* Locations are used to identify the current position of
* a suspended thread (analogous to an instruction pointer or
* program counter register in native programs). They are also used
* to identify the position at which to set a breakpoint.
* <p>
* The availability of a line number for a location will
* depend on the level of debugging information available from the
* target VM.
* <p>
* Several mirror interfaces have locations. Each such mirror
* extends a {@link Locatable} interface.
* <p>
* <a name="strata"><b>Strata</b></a>
* <p>
* The source information for a Location is dependent on the
* <i>stratum</i> which is used. A stratum is a source code
* level within a sequence of translations. For example,
* say the baz program is written in the programming language
* "Foo" then translated to the language "Bar" and finally
* translated into the Java programming language. The
* Java programming language stratum is named
* <code>"Java"</code>, let's say the other strata are named
* "Foo" and "Bar". A given location (as viewed by the
* {@link #sourceName()} and {@link #lineNumber()} methods)
* might be at line 14 of "baz.foo" in the <code>"Foo"</code>
* stratum, line 23 of "baz.bar" in the <code>"Bar"</code>
* stratum and line 71 of the <code>"Java"</code> stratum.
* Note that while the Java programming language may have
* only one source file for a reference type, this restriction
* does not apply to other strata - thus each Location should
* be consulted to determine its source path.
* Queries which do not specify a stratum
* ({@link #sourceName()}, {@link #sourcePath()} and
* {@link #lineNumber()}) use the VM's default stratum
* ({@link VirtualMachine#getDefaultStratum()}).
* If the specified stratum (whether explicitly specified
* by a method parameter or implicitly as the VM's default)
* is <code>null</code> or is not available in the declaring
* type, the declaring type's default stratum is used
* ({@link #declaringType()}.{@link ReferenceType#defaultStratum()
* defaultStratum()}). Note that in the normal case, of code
* that originates as Java programming language source, there
* will be only one stratum (<code>"Java"</code>) and it will be
* returned as the default. To determine the available strata
* use {@link ReferenceType#availableStrata()}.
*
* @see com.sun.jdi.request.EventRequestManager
* @see StackFrame
* @see com.sun.jdi.event.BreakpointEvent
* @see com.sun.jdi.event.ExceptionEvent
* @see Locatable
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Location extends Mirror, Comparable<Location> {
/**
* Gets the type to which this Location belongs. Normally
* the declaring type is a {@link ClassType}, but executable
* locations also may exist within the static initializer of an
* {@link InterfaceType}.
*
* @return the {@link ReferenceType} containing this Location.
*/
ReferenceType declaringType();
/**
* Gets the method containing this Location.
*
* @return the location's {@link Method}.
*/
Method method();
/**
* Gets the code position within this location's method.
*
* @return the long representing the position within the method
* or -1 if location is within a native method.
*/
long codeIndex();
/**
* Gets an identifing name for the source corresponding to
* this location.
* <P>
* This method is equivalent to
* <code>sourceName(vm.getDefaultStratum())</code> -
* see {@link #sourceName(String)}
* for more information.
*
* @return a string specifying the source
* @throws AbsentInformationException if the source name is not
* known
*/
String sourceName() throws AbsentInformationException;
/**
* Gets an identifing name for the source corresponding to
* this location. Interpretation of this string is the
* responsibility of the source repository mechanism.
* <P>
* Returned name is for the specified <i>stratum</i>
* (see the {@link Location class comment} for a
* description of strata).
* <P>
* The returned string is the unqualified name of the source
* file for this Location. For example,
* <CODE>java.lang.Thread</CODE> would return
* <CODE>"Thread.java"</CODE>.
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the declaring type's
* default stratum.
*
* @return a string specifying the source
*
* @throws AbsentInformationException if the source name is not
* known
*
* @since 1.4
*/
String sourceName(String stratum)
throws AbsentInformationException;
/**
* Gets the path to the source corresponding to this
* location.
* <P>
* This method is equivalent to
* <code>sourcePath(vm.getDefaultStratum())</code> -
* see {@link #sourcePath(String)}
* for more information.
*
* @return a string specifying the source
*
* @throws AbsentInformationException if the source name is not
* known
*/
String sourcePath() throws AbsentInformationException;
/**
* Gets the path to the source corresponding to this
* location. Interpretation of this string is the
* responsibility of the source repository mechanism.
* <P>
* Returned path is for the specified <i>stratum</i>
* (see the {@link Location class comment} for a
* description of strata).
* <P>
* In the reference implementation, for strata which
* do not explicitly specify source path (the Java
* programming language stratum never does), the returned
* string is the package name of {@link #declaringType()}
* converted to a platform dependent path followed by the
* unqualified name of the source file for this Location
* ({@link #sourceName sourceName(stratum)}).
* For example, on a
* Windows platform, <CODE>java.lang.Thread</CODE>
* would return
* <CODE>"java\lang\Thread.java"</CODE>.
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the declaring type's
* default stratum.
*
* @return a string specifying the source
*
* @throws AbsentInformationException if the source name is not
* known
*
* @since 1.4
*/
String sourcePath(String stratum)
throws AbsentInformationException;
/**
* Gets the line number of this Location.
* <P>
* This method is equivalent to
* <code>lineNumber(vm.getDefaultStratum())</code> -
* see {@link #lineNumber(String)}
* for more information.
*
* @return an int specifying the line in the source, returns
* -1 if the information is not available; specifically, always
* returns -1 for native methods.
*/
int lineNumber();
/**
* The line number of this Location. The line number is
* relative to the source specified by
* {@link #sourceName(String) sourceName(stratum)}.
* <P>
* Returned line number is for the specified <i>stratum</i>
* (see the {@link Location class comment} for a
* description of strata).
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the declaring type's
* default stratum.
*
* @return an int specifying the line in the source, returns
* -1 if the information is not available; specifically, always
* returns -1 for native methods.
*
* @since 1.4
*/
int lineNumber(String stratum);
/**
* Compares the specified Object with this Location for equality.
*
* @return true if the Object is a Location and if it refers to
* the same point in the same VM as this Location.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this Location.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive <code>long</code> values
* accessed in the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see LongValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface LongType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>long</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface LongValue extends PrimitiveValue, Comparable<LongValue> {
/**
* Returns this LongValue as a long.
*
* @return the <code>long</code> mirrored by this object.
*/
long value();
/**
* Compares the specified Object with this LongValue for equality.
*
* @return true if the Object is a LongValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this LongValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,442 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A static or instance method in the target VM. See {@link TypeComponent}
* for general information about Field and Method mirrors.
*
* @see ObjectReference
* @see ReferenceType
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Method extends TypeComponent, Locatable, Comparable<Method> {
/**
* Returns a text representation of the return type,
* as specified in the declaration of this method.
* <P>
* This type name is always available even if
* the type has not yet been created or loaded.
*
* @return a String containing the return type name.
*/
String returnTypeName();
/**
* Returns the return type,
* as specified in the declaration of this method.
* <P>
* Note: if the return type of this method is a reference type (class,
* interface, or array) and it has not been created or loaded
* by the declaring type's class loader - that is,
* {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
* <CODE>.classLoader()</CODE>,
* then ClassNotLoadedException will be thrown.
* Also, a reference type may have been loaded but not yet prepared,
* in which case the type will be returned
* but attempts to perform some operations on the returned type
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @see Type
* @see Field#type() Field.type() - for usage examples
* @return the return {@link Type} of this method.
* @throws ClassNotLoadedException if the type has not yet been
* created or loaded
* through the appropriate class loader.
*/
Type returnType() throws ClassNotLoadedException;
/**
* Returns a list containing a text representation of the type
* of each formal parameter of this method.
* <P>
* This list is always available even if
* the types have not yet been created or loaded.
*
* @return a {@link java.util.List List} of {@link String},
* one List element for each parameter of this method.
* Each element represents the type of a formal parameter
* as specified at compile-time.
* If the formal parameter was declared with an ellipsis, then
* it is represented as an array of the type before the ellipsis.
*
*/
List<String> argumentTypeNames();
/**
* Returns a list containing the type
* of each formal parameter of this method.
* <P>
* Note: if there is any parameter whose type
* is a reference type (class, interface, or array)
* and it has not been created or loaded
* by the declaring type's class loader - that is,
* {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
* <CODE>.classLoader()</CODE>,
* then ClassNotLoadedException will be thrown.
* Also, a reference type may have been loaded but not yet prepared,
* in which case the list will be returned
* but attempts to perform some operations on the type
* (e.g. {@link ReferenceType#fields() fields()}) will throw
* a {@link ClassNotPreparedException}.
* Use {@link ReferenceType#isPrepared()} to determine if
* a reference type is prepared.
*
* @see Type
* @return return a {@link java.util.List List} of {@link Type},
* one List element for each parameter of this method.
* Each element represents the type of a formal parameter
* as specified at compile-time.
* If the formal parameter was declared with an ellipsis, then
* it is represented as an array of the type before the ellipsis.
*
* @throws ClassNotLoadedException if the type has not yet been loaded
* through the appropriate class loader.
*/
List<Type> argumentTypes() throws ClassNotLoadedException;
/**
* Determine if this method is abstract.
*
* @return <code>true</code> if the method is declared abstract;
* false otherwise.
*/
boolean isAbstract();
/**
* Determine if this method is a default method
*
* @return <code>true</code> if the method is declared default;
* false otherwise
*
* @since 1.8
*/
default boolean isDefault() {
throw new UnsupportedOperationException();
}
/**
* Determine if this method is synchronized.
*
* @return <code>true</code> if the method is declared synchronized;
* false otherwise.
*/
boolean isSynchronized();
/**
* Determine if this method is native.
*
* @return <code>true</code> if the method is declared native;
* false otherwise.
*/
boolean isNative();
/**
* Determine if this method accepts a variable number of arguments.
*
* @return <code>true</code> if the method accepts a variable number
* of arguments, false otherwise.
*
* @since 1.5
*/
boolean isVarArgs();
/**
* Determine if this method is a bridge method. Bridge
* methods are defined in
* <cite>The Java&trade; Language Specification</cite>.
*
* @return <code>true</code> if the method is a bridge method,
* false otherwise.
*
* @since 1.5
*/
boolean isBridge();
/**
* Determine if this method is a constructor.
*
* @return <code>true</code> if the method is a constructor;
* false otherwise.
*/
boolean isConstructor();
/**
* Determine if this method is a static initializer.
*
* @return <code>true</code> if the method is a static initializer;
* false otherwise.
*/
boolean isStaticInitializer();
/**
* Determine if this method is obsolete.
*
* @return <code>true</code> if this method has been made obsolete by a
* {@link VirtualMachine#redefineClasses} operation.
*
* @since 1.4
*/
boolean isObsolete();
/**
* Returns a list containing a {@link Location} object for
* each executable source line in this method.
* <P>
* This method is equivalent to
* <code>allLineLocations(vm.getDefaultStratum(),null)</code> -
* see {@link #allLineLocations(String,String)}
* for more information.
*
* @return a List of all source line {@link Location} objects.
*
* @throws AbsentInformationException if there is no line
* number information for this (non-native, non-abstract)
* method.
*/
List<Location> allLineLocations() throws AbsentInformationException;
/**
* Returns a list containing a {@link Location} object for
* each executable source line in this method.
* <P>
* Each location maps a source line to a range of code
* indices.
* The beginning of the range can be determined through
* {@link Location#codeIndex}.
* The returned list is ordered by code index
* (from low to high).
* <P>
* The returned list may contain multiple locations for a
* particular line number, if the compiler and/or VM has
* mapped that line to two or more disjoint code index ranges.
* <P>
* If the method is native or abstract, an empty list is
* returned.
* <P>
* Returned list is for the specified <i>stratum</i>
* (see {@link Location} for a description of strata).
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the {@link ReferenceType#defaultStratum()}
*
* @param sourceName Return locations only within this
* source file or <code>null</code> to return locations.
*
* @return a List of all source line {@link Location} objects.
*
* @throws AbsentInformationException if there is no line
* number information for this (non-native, non-abstract)
* method. Or if <i>sourceName</i> is non-<code>null</code>
* and source name information is not present.
*
* @since 1.4
*/
List<Location> allLineLocations(String stratum, String sourceName)
throws AbsentInformationException;
/**
* Returns a List containing all {@link Location} objects
* that map to the given line number.
* <P>
* This method is equivalent to
* <code>locationsOfLine(vm.getDefaultStratum(), null,
* lineNumber)</code> -
* see {@link
* #locationsOfLine(java.lang.String,java.lang.String,int)}
* for more information.
*
* @param lineNumber the line number
*
* @return a List of {@link Location} objects that map to
* the given line number.
*
* @throws AbsentInformationException if there is no line
* number information for this method.
*/
List<Location> locationsOfLine(int lineNumber) throws AbsentInformationException;
/**
* Returns a List containing all {@link Location} objects
* that map to the given line number and source name.
* <P>
* Returns a list containing each {@link Location} that maps
* to the given line. The returned list will contain a
* location for each disjoint range of code indices that have
* been assigned to the given line by the compiler and/or
* VM. Each returned location corresponds to the beginning of
* this range. An empty list will be returned if there is no
* executable code at the specified line number; specifically,
* native and abstract methods will always return an empty
* list.
* <p>
* Returned list is for the specified <i>stratum</i>
* (see {@link Location} for a description of strata).
*
* @param stratum the stratum to use for comparing line number
* and source name, or null to use the default
* stratum
* @param sourceName the source name containing the
* line number, or null to match all
* source names
* @param lineNumber the line number
*
* @return a List of {@link Location} objects that map to
* the given line number.
*
* @throws AbsentInformationException if there is no line
* number information for this method.
* Or if <i>sourceName</i> is non-<code>null</code>
* and source name information is not present.
*
* @since 1.4
*/
List<Location> locationsOfLine(String stratum, String sourceName,
int lineNumber)
throws AbsentInformationException;
/**
* Returns a {@link Location} for the given code index.
*
* @return the {@link Location} corresponding to the
* given code index or null if the specified code index is not a
* valid code index for this method (native and abstract methods
* will always return null).
*/
Location locationOfCodeIndex(long codeIndex);
/**
* Returns a list containing each {@link LocalVariable} declared
* in this method. The list includes any variable declared in any
* scope within the method. It may contain multiple variables of the
* same name declared within disjoint scopes. Arguments are considered
* local variables and will be present in the returned list.
*
* If local variable information is not available, values of
* actual arguments to method invocations can be obtained
* by using the method {@link StackFrame#getArgumentValues()}
*
* @return the list of {@link LocalVariable} objects which mirror
* local variables declared in this method in the target VM.
* If there are no local variables, a zero-length list is returned.
* @throws AbsentInformationException if there is no variable
* information for this method.
* Generally, local variable information is not available for
* native or abstract methods (that is, their argument name
* information is not available), thus they will throw this exception.
*/
List<LocalVariable> variables() throws AbsentInformationException;
/**
* Returns a list containing each {@link LocalVariable} of a
* given name in this method.
* Multiple variables can be returned
* if the same variable name is used in disjoint
* scopes within the method.
*
* @return the list of {@link LocalVariable} objects of the given
* name.
* If there are no matching local variables, a zero-length list
* is returned.
* @throws AbsentInformationException if there is no variable
* information for this method.
* Generally, local variable information is not available for
* native or abstract methods (that is, their argument name
* information is not available), thus they will throw this exception.
*/
List<LocalVariable> variablesByName(String name)
throws AbsentInformationException;
/**
* Returns a list containing each {@link LocalVariable} that is
* declared as an argument of this method.
*
* If local variable information is not available, values of
* actual arguments to method invocations can be obtained
* by using the method {@link StackFrame#getArgumentValues()}
*
* @return the list of {@link LocalVariable} arguments.
* If there are no arguments, a zero-length list is returned.
* @throws AbsentInformationException if there is no variable
* information for this method.
* Generally, local variable information is not available for
* native or abstract methods (that is, their argument name
* information is not available), thus they will throw this exception.
*/
List<LocalVariable> arguments() throws AbsentInformationException;
/**
* Returns an array containing the bytecodes for this method.
* <P>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetBytecodes()}
* to determine if the operation is supported.
*
* @return the array of bytecodes; abstract and native methods
* will return a zero-length array.
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support
* the retrieval of bytecodes.
*/
byte[] bytecodes();
/**
* Returns the {@link Location} of this method, if there
* is executable code associated with it.
*
* @return the {@link Location} of this mirror, or null if
* this is an abstract method; native methods will return a
* Location object whose codeIndex is -1.
*/
Location location();
/**
* Compares the specified Object with this method for equality.
*
* @return true if the Object is a method and if both
* mirror the same method (declared in the same class or interface, in
* the same VM).
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this Method.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* A proxy used by a debugger to examine or manipulate some entity
* in another virtual machine. Mirror is the root of the
* interface hierarchy for this package. Mirrors can be proxies for objects
* in the target VM ({@link ObjectReference}), primitive values
* (for example, {@link IntegerValue}), types (for example,
* {@link ReferenceType}), dynamic application state (for example,
* {@link StackFrame}), and even debugger-specific constructs (for example,
* {@link com.sun.jdi.request.BreakpointRequest}).
* The {@link VirtualMachine} itself is also
* considered a mirror, representing the composite state of the
* target VM.
* <P>
* There is no guarantee that a particular entity in the target VM will map
* to a single instance of Mirror. Implementors are free to decide
* whether a single mirror will be used for some or all mirrors. Clients
* of this interface should always use <code>equals</code> to compare
* two mirrors for equality.
* <p>
* Any method on a {@link com.sun.jdi.Mirror} that takes a <code>Mirror</code> as an
* parameter directly or indirectly (e.g., as a element in a <code>List</code>) will
* throw {@link com.sun.jdi.VMMismatchException} if the mirrors are from different
* virtual machines.
*
* @see VirtualMachine
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Mirror {
/**
* Gets the VirtualMachine to which this
* Mirror belongs. A Mirror must be associated
* with a VirtualMachine to have any meaning.
*
* @return the {@link VirtualMachine} for which this mirror is a proxy.
*/
VirtualMachine virtualMachine();
/**
* Returns a String describing this mirror
*
* @return a string describing this mirror.
*/
String toString();
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Information about a monitor owned by a thread.
*
* @author Swamy Venkataramanappa
* @since 1.6
*/
@jdk.Exported
public interface MonitorInfo extends Mirror {
/**
* Returns the {@link ObjectReference} object for the monitor.
* @return the {@link ObjectReference} object for the monitor.
* @throws InvalidStackFrameException if the associated stack
* frame has become invalid. Once the frame's thread is resumed,
* the stack frame is no longer valid.
* @see ThreadReference#ownedMonitorsAndFrames
* @since 1.6
*/
public ObjectReference monitor();
/**
* Returns the stack depth at which this monitor was
* acquired by the owning thread. Returns -1 if the
* implementation cannot determine the stack depth
* (e.g., for monitors acquired by JNI MonitorEnter).
* @return the stack depth at which this monitor was
* acquired by the owning thread.
* @throws InvalidStackFrameException if the associated stack
* frame has become invalid. Once the frame's thread is resumed,
* the stack frame is no longer valid.
* @see ThreadReference#ownedMonitorsAndFrames
*/
public int stackDepth();
/**
* Returns a {@link ThreadReference} object for the thread that
* owns the monitor.
* @return a {@link ThreadReference} object for the thread that
* owns the monitor.
* @throws InvalidStackFrameException if the associated stack
* frame has become invalid. Once the frame's thread is resumed,
* the stack frame is no longer valid.
* @see ThreadReference#frame
*/
ThreadReference thread();
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate an operation cannot be completed because
* it is not valid for a native method.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
public NativeMethodException() {
super();
}
public NativeMethodException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the specified object has been garbage collected.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class ObjectCollectedException extends RuntimeException {
private static final long serialVersionUID = -1928428056197269588L;
public ObjectCollectedException() {
super();
}
public ObjectCollectedException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,445 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
import java.util.Map;
/**
* An object that currently exists in the target VM. An ObjectReference
* mirrors only the object itself and is not specific to any
* {@link Field} or {@link LocalVariable} to which it is currently
* assigned. An ObjectReference can
* have 0 or more references from field(s) and/or variable(s).
* <p>
* Any method on <code>ObjectReference</code> which directly or
* indirectly takes <code>ObjectReference</code> as an parameter may throw
* {@link com.sun.jdi.VMDisconnectedException} if the target VM is
* disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
* available to be read from the {@link com.sun.jdi.event.EventQueue}.
* <p>
* Any method on <code>ObjectReference</code> which directly or
* indirectly takes <code>ObjectReference</code> as an parameter may throw
* {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
* <p>
* Any method on <code>ObjectReference</code> or which directly or indirectly takes
* <code>ObjectReference</code> as parameter may throw
* {@link com.sun.jdi.ObjectCollectedException} if the mirrored object has been
* garbage collected.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ObjectReference extends Value {
/**
* Gets the {@link ReferenceType} that mirrors the type
* of this object. The type may be a subclass or implementor of the
* declared type of any field or variable which currently holds it.
* For example, right after the following statement.
* <p>
* <code>Object obj = new String("Hello, world!");</code>
* <p>
* The ReferenceType of obj will mirror java.lang.String and not
* java.lang.Object.
* <p>
* The type of an object never changes, so this method will
* always return the same ReferenceType over the lifetime of the
* mirrored object.
* <p>
* The returned ReferenceType will be a {@link ClassType} or
* {@link ArrayType} and never an {@link InterfaceType}.
*
* @return the {@link ReferenceType} for this object.
*/
ReferenceType referenceType();
/**
* Gets the value of a given instance or static field in this object.
* The Field must be valid for this ObjectReference;
* that is, it must be from
* the mirrored object's class or a superclass of that class.
*
* @param sig the field containing the requested value
* @return the {@link Value} of the instance field.
* @throws java.lang.IllegalArgumentException if the field is not valid for
* this object's class.
*/
Value getValue(Field sig);
/**
* Gets the value of multiple instance and/or static fields in this object.
* The Fields must be valid for this ObjectReference;
* that is, they must be from
* the mirrored object's class or a superclass of that class.
*
* @param fields a list of {@link Field} objects containing the
* requested values.
* @return a Map of the requested {@link Field} objects with
* their {@link Value}.
* @throws java.lang.IllegalArgumentException if any field is not valid for
* this object's class.
*/
Map<Field,Value> getValues(List<? extends Field> fields);
/**
* Sets the value of a given instance or static field in this object.
* The {@link Field} must be valid for this ObjectReference; that is,
* it must be from the mirrored object's class or a superclass of that class.
* If static, the field must not be final.
* <p>
* Object values must be assignment compatible with the field type
* (This implies that the field type must be loaded through the
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the field type or must be
* convertible to the field type without loss of information.
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment
* compatibility.
*
* @param field the field containing the requested value
* @param value the new value to assign
* @throws java.lang.IllegalArgumentException if the field is not valid for
* this object's class.
* @throws InvalidTypeException if the value's type does not match
* the field's type.
* @throws ClassNotLoadedException if 'value' is not null, and the field
* type has not yet been loaded through the appropriate class loader.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void setValue(Field field, Value value)
throws InvalidTypeException, ClassNotLoadedException;
/** Perform method invocation with only the invoking thread resumed */
static final int INVOKE_SINGLE_THREADED = 0x1;
/** Perform non-virtual method invocation */
static final int INVOKE_NONVIRTUAL = 0x2;
/**
* Invokes the specified {@link Method} on this object in the
* target VM. The
* specified method can be defined in this object's class,
* in a superclass of this object's class, or in an interface
* implemented by this object. The method may be a static method
* or an instance method, but not a static initializer or constructor.
* Use {@link ClassType#newInstance} to create a new object and
* run its constructor.
* <p>
* The method invocation will occur in the specified thread.
* Method invocation can occur only if the specified thread
* has been suspended by an event which occurred in that thread.
* Method invocation is not supported
* when the target VM has been suspended through
* {@link VirtualMachine#suspend} or when the specified thread
* is suspended through {@link ThreadReference#suspend}.
* <p>
* The specified method is invoked with the arguments in the specified
* argument list. The method invocation is synchronous; this method
* does not return until the invoked method returns in the target VM.
* If the invoked method throws an exception, this method
* will throw an {@link InvocationException} which contains
* a mirror to the exception object thrown.
* <p>
* Object arguments must be assignment compatible with the argument type
* (This implies that the argument type must be loaded through the
* enclosing class's class loader). Primitive arguments must be
* either assignment compatible with the argument type or must be
* convertible to the argument type without loss of information.
* If the method being called accepts a variable number of arguments,
* then the last argument type is an array of some component type.
* The argument in the matching position can be omitted, or can be null,
* an array of the same component type, or an argument of the
* component type followed by any number of other arguments of the same
* type. If the argument is omitted, then a 0 length array of the
* component type is passed. The component type can be a primitive type.
* Autoboxing is not supported.
*
* See section 5.2 of
* <cite>The Java&trade; Language Specification</cite>
* for more information on assignment compatibility.
* <p>
* By default, the method is invoked using dynamic lookup as
* documented in section 15.12.4.4 of
* <cite>The Java&trade; Language Specification</cite>
* in particular, overriding based on the runtime type of the object
* mirrored by this {@link ObjectReference} will occur. This
* behavior can be changed by specifying the
* {@link #INVOKE_NONVIRTUAL} bit flag in the <code>options</code>
* argument. If this flag is set, the specified method is invoked
* whether or not it is overridden for this object's runtime type.
* The method, in this case, must have an implementation, either in a class
* or an interface. This option is useful for performing method invocations
* like those done with the <code>super</code> keyword in the Java programming
* language.
* <p>
* By default, all threads in the target VM are resumed while
* the method is being invoked if they were previously
* suspended by an event or by {@link VirtualMachine#suspend} or
* {@link ThreadReference#suspend}. This is done to prevent the deadlocks
* that will occur if any of the threads own monitors
* that will be needed by the invoked method.
* Note, however, that this implicit resume acts exactly like
* {@link ThreadReference#resume}, so if the thread's suspend
* count is greater than 1, it will remain in a suspended state
* during the invocation and thus a deadlock could still occur.
* By default, when the invocation completes,
* all threads in the target VM are suspended, regardless their state
* before the invocation.
* It is possible that
* breakpoints or other events might occur during the invocation.
* This can cause deadlocks as described above. It can also cause a deadlock
* if invokeMethod is called from the client's event handler thread. In this
* case, this thread will be waiting for the invokeMethod to complete and
* won't read the EventSet that comes in for the new event. If this
* new EventSet is SUSPEND_ALL, then a deadlock will occur because no
* one will resume the EventSet. To avoid this, all EventRequests should
* be disabled before doing the invokeMethod, or the invokeMethod should
* not be done from the client's event handler thread.
* <p>
* The resumption of other threads during the invocation can be prevented
* by specifying the {@link #INVOKE_SINGLE_THREADED}
* bit flag in the <code>options</code> argument; however,
* there is no protection against or recovery from the deadlocks
* described above, so this option should be used with great caution.
* Only the specified thread will be resumed (as described for all
* threads above). Upon completion of a single threaded invoke, the invoking thread
* will be suspended once again. Note that any threads started during
* the single threaded invocation will not be suspended when the
* invocation completes.
* <p>
* If the target VM is disconnected during the invoke (for example, through
* {@link VirtualMachine#dispose}) the method invocation continues.
*
* @param thread the thread in which to invoke.
* @param method the {@link Method} to invoke.
* @param arguments the list of {@link Value} arguments bound to the
* invoked method. Values from the list are assigned to arguments
* in the order they appear in the method signature.
* @param options the integer bit flag options.
* @return a {@link Value} mirror of the invoked method's return value.
* @throws java.lang.IllegalArgumentException if the method is not
* a member of this object's class, if the size of the argument list
* does not match the number of declared arguments for the method,
* if the method is a constructor or static intializer, or
* if {@link #INVOKE_NONVIRTUAL} is specified and the method is
* either abstract or a non-default interface member.
* @throws {@link InvalidTypeException} if any argument in the
* argument list is not assignable to the corresponding method argument
* type.
* @throws ClassNotLoadedException if any argument type has not yet been loaded
* through the appropriate class loader.
* @throws IncompatibleThreadStateException if the specified thread has not
* been suspended by an event.
* @throws InvocationException if the method invocation resulted in
* an exception in the target VM.
* @throws InvalidTypeException If the arguments do not meet this requirement --
* Object arguments must be assignment compatible with the argument
* type. This implies that the argument type must be
* loaded through the enclosing class's class loader.
* Primitive arguments must be either assignment compatible with the
* argument type or must be convertible to the argument type without loss
* of information. See JLS section 5.2 for more information on assignment
* compatibility.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
Value invokeMethod(ThreadReference thread, Method method,
List<? extends Value> arguments, int options)
throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException;
/**
* Prevents garbage collection for this object. By default all
* {@link ObjectReference} values returned by JDI may be collected
* at any time the target VM is running. A call to this method
* guarantees that the object will not be collected.
* {@link #enableCollection} can be used to allow collection once
* again.
* <p>
* Calls to this method are counted. Every call to this method
* requires a corresponding call to {@link #enableCollection} before
* garbage collection is re-enabled.
* <p>
* Note that while the target VM is suspended, no garbage collection
* will occur because all threads are suspended. The typical
* examination of variables, fields, and arrays during the suspension
* is safe without explicitly disabling garbage collection.
* <p>
* This method should be used sparingly, as it alters the
* pattern of garbage collection in the target VM and,
* consequently, may result in application behavior under the
* debugger that differs from its non-debugged behavior.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
void disableCollection();
/**
* Permits garbage collection for this object. By default all
* {@link ObjectReference} values returned by JDI may be collected
* at any time the target VM is running. A call to this method
* is necessary only if garbage collection was previously disabled
* with {@link #disableCollection}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
void enableCollection();
/**
* Determines if this object has been garbage collected in the target
* VM.
*
* @return <code>true</code> if this {@link ObjectReference} has been collected;
* <code>false</code> otherwise.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
boolean isCollected();
/**
* Returns a unique identifier for this ObjectReference.
* It is guaranteed to be unique among all
* ObjectReferences from the same VM that have not yet been disposed.
* The guarantee applies as long
* as this ObjectReference has not yet been disposed.
*
* @return a long unique ID
*/
long uniqueID();
/**
* Returns a List containing a {@link ThreadReference} for
* each thread currently waiting for this object's monitor.
* See {@link ThreadReference#currentContendedMonitor} for
* information about when a thread is considered to be waiting
* for a monitor.
* <p>
* Not all target VMs support this operation. See
* VirtualMachine#canGetMonitorInfo to determine if the
* operation is supported.
*
* @return a List of {@link ThreadReference} objects. The list
* has zero length if no threads are waiting for the monitor.
* @throws java.lang.UnsupportedOperationException if the
* target VM does not support this operation.
* @throws IncompatibleThreadStateException if any
* waiting thread is not suspended
* in the target VM
*/
List<ThreadReference> waitingThreads()
throws IncompatibleThreadStateException;
/**
* Returns an {@link ThreadReference} for the thread, if any,
* which currently owns this object's monitor.
* See {@link ThreadReference#ownedMonitors} for a definition
* of ownership.
* <p>
* Not all target VMs support this operation. See
* VirtualMachine#canGetMonitorInfo to determine if the
* operation is supported.
*
* @return the {@link ThreadReference} which currently owns the
* monitor, or null if it is unowned.
*
* @throws java.lang.UnsupportedOperationException if the
* target VM does not support this operation.
* @throws IncompatibleThreadStateException if the owning thread is
* not suspended in the target VM
*/
ThreadReference owningThread() throws IncompatibleThreadStateException;
/**
* Returns the number times this object's monitor has been
* entered by the current owning thread.
* See {@link ThreadReference#ownedMonitors} for a definition
* of ownership.
* <p>
* Not all target VMs support this operation. See
* VirtualMachine#canGetMonitorInfo to determine if the
* operation is supported.
*
* @see #owningThread
* @return the integer count of the number of entries.
*
* @throws java.lang.UnsupportedOperationException if the
* target VM does not support this operation.
* @throws IncompatibleThreadStateException if the owning thread is
* not suspended in the target VM
*/
int entryCount() throws IncompatibleThreadStateException;
/**
* Returns objects that directly reference this object.
* Only objects that are reachable for the purposes of garbage collection
* are returned. Note that an object can also be referenced in other ways,
* such as from a local variable in a stack frame, or from a JNI global
* reference. Such non-object referrers are not returned by this method.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetInstanceInfo()}
* to determine if the operation is supported.
*
* @see VirtualMachine#instanceCounts(List)
* @see ReferenceType#instances(long)
* @param maxReferrers The maximum number of referring objects to return.
* Must be non-negative. If zero, all referring
* objects are returned.
* @return a of List of {@link ObjectReference} objects. If there are
* no objects that reference this object, a zero-length list is returned..
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetInstanceInfo() canGetInstanceInfo()}
* @throws java.lang.IllegalArgumentException if maxReferrers is less
* than zero.
* @since 1.6
*/
List<ObjectReference> referringObjects(long maxReferrers);
/**
* Compares the specified Object with this ObjectReference for equality.
*
* @return true if the Object is an ObjectReference, if the
* ObjectReferences belong to the same VM, and if applying the
* "==" operator on the mirrored objects in that VM evaluates to true.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this ObjectReference.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A virtual machine which searches for classes through paths
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface PathSearchingVirtualMachine extends VirtualMachine {
/**
* Get the class path for this virtual machine.
*
* @return {@link List} of components of the classpath,
* each represented by a {@link String}.
*/
List<String> classPath();
/**
* Get the boot class path for this virtual machine.
*
* @return {@link List} of components of the boot class path,
* each represented by a {@link String}.
*/
List<String> bootClassPath();
/**
* Get the base directory used for path searching. Relative directories
* in the class path and boot class path can be resolved through
* this directory name.
*
* @return the base directory.
*/
String baseDirectory();
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type associated with non-object values in a target VM.
* Instances of one of the sub-interfaces of this interface will be
* returned from {@link Value#type} for all {@link PrimitiveValue} objects.
*
* @see PrimitiveValue
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface PrimitiveType extends Type {
}

View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The value assigned to a field or variable of primitive type in a
* target VM. Each primitive values is accessed through a subinterface
* of this interface.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface PrimitiveValue extends Value {
/**
* Converts this value to a BooleanValue and returns the result
* as a boolean.
*
* @return <code>true</code> if this value is non-zero (or
* <code>true</code> if already a BooleanValue); false otherwise.
*/
boolean booleanValue();
/**
* Converts this value to a ByteValue and returns the result
* as a byte. The value will be narrowed as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to a byte).
*
* @return the value, converted to byte
*/
byte byteValue();
/**
* Converts this value to a CharValue and returns the result
* as a char. The value will be narrowed or widened as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to a char,
* in the narrowing case).
*
* @return the value, converted to char
*/
char charValue();
/**
* Converts this value to a ShortValue and returns the result
* as a short. The value will be narrowed or widened as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to a short,
* in the narrowing case).
*
* @return the value, converted to short
*/
short shortValue();
/**
* Converts this value to an IntegerValue and returns the result
* as an int. The value will be narrowed or widened as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to an int,
* in the narrowing case).
*
* @return the value, converted to int
*/
int intValue();
/**
* Converts this value to a LongValue and returns the result
* as a long. The value will be narrowed or widened as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to a long,
* in the narrowing case).
*
* @return the value, converted to long
*/
long longValue();
/**
* Converts this value to a FloatValue and returns the result
* as a float. The value will be narrowed or widened as
* necessary, and magnitude or precision information
* may be lost (as if the primitive had been cast to a float,
* in the narrowing case).
*
* @return the value, converted to float
*/
float floatValue();
/**
* Converts this value to a DoubleValue and returns the result
* as a double. The value will be widened as
* necessary, and precision information
* may be lost.
*
* @return the value, converted to double
*/
double doubleValue();
}

View File

@@ -0,0 +1,831 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
import java.util.Map;
/**
* The type of an object in a target VM. ReferenceType encompasses
* classes, interfaces, and array types as defined in
* <cite>The Java&trade; Language Specification</cite>.
* All ReferenceType objects belong to one of the following
* subinterfaces:
* {@link ClassType} for classes,
* {@link InterfaceType} for interfaces, and
* {@link ArrayType} for arrays.
* Note that primitive classes (for example, the
* {@link ClassObjectReference#reflectedType() reflected type} of
* {@link java.lang.Integer#TYPE Integer.TYPE})
* are represented as ClassType.
* The VM creates Class objects for all three, so from the VM perspective,
* each ReferenceType maps to a distinct Class object.
* <p>
* ReferenceTypes can
* be obtained by querying a particular {@link ObjectReference} for its
* type or by getting a list of all reference types from the
* {@link VirtualMachine}.
* <p>
* ReferenceType provides access to static type information such as
* methods and fields and provides access to dynamic type
* information such as the corresponding Class object and the classloader.
* <p>
* Any method on <code>ReferenceType</code> which directly or
* indirectly takes <code>ReferenceType</code> as an parameter may throw
* {@link com.sun.jdi.VMDisconnectedException} if the target VM is
* disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
* available to be read from the {@link com.sun.jdi.event.EventQueue}.
* <p>
* Any method on <code>ReferenceType</code> which directly or
* indirectly takes <code>ReferenceType</code> as an parameter may throw
* {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
* <p>
* Any method on <code>ReferenceType</code> or which directly or indirectly takes
* <code>ReferenceType</code> as parameter may throw
* {@link com.sun.jdi.ObjectCollectedException} if the mirrored type has been unloaded.
*
* @see ObjectReference
* @see ObjectReference#referenceType
* @see VirtualMachine
* @see VirtualMachine#allClasses
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ReferenceType
extends Type, Comparable<ReferenceType>, Accessible
{
/**
* Gets the fully qualified name of this type. The returned name
* is formatted as it might appear in a Java programming langauge
* declaration for objects of this type.
* <p>
* For primitive classes
* the returned name is the name of the corresponding primitive
* type; for example, "int" is returned as the name of the class
* represented by {@link java.lang.Integer#TYPE Integer.TYPE}.
* @return a string containing the type name.
*/
String name();
/**
* Gets the generic signature for this type if there is one.
* Generic signatures are described in the
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.
*
* @since 1.5
*/
String genericSignature();
/**
* Gets the classloader object which loaded the class corresponding
* to this type.
*
* @return a {@link ClassLoaderReference} which mirrors the classloader,
* or <code>null</code> if the class was loaded through the bootstrap class
* loader.
*/
ClassLoaderReference classLoader();
/**
* Gets an identifying name for the source corresponding to the
* declaration of this type. Interpretation of this string is
* the responsibility of the source repository mechanism.
* <P>
* The returned name is dependent on VM's default stratum
* ({@link VirtualMachine#getDefaultStratum()}).
* In the reference implementation, when using the base stratum,
* the returned string is the
* unqualified name of the source file containing the declaration
* of this type. In other strata the returned source name is
* the first source name for that stratum. Since other languages
* may have more than one source name for a reference type,
* the use of {@link Location#sourceName()} or
* {@link #sourceNames(String)} is preferred.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* AbsentInformationException is always thrown.
*
* @return the string source file name
* @throws AbsentInformationException if the source name is not
* known
*/
String sourceName() throws AbsentInformationException;
/**
* Gets the identifying names for all the source corresponding to the
* declaration of this type. Interpretation of these names is
* the responsibility of the source repository mechanism.
* <P>
* The returned names are for the specified stratum
* (see {@link Location} for a description of strata).
* In the reference implementation, when using the Java
* programming language stratum,
* the returned List contains one element: a String which is the
* unqualified name of the source file containing the declaration
* of this type. In other strata the returned source names are
* all the source names defined for that stratum.
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the declaring type's
* default stratum.
*
* @return a List of String objects each representing a source name
*
* @throws AbsentInformationException if the source names are not
* known.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* AbsentInformationException is always thrown.
*
* @since 1.4
*/
List<String> sourceNames(String stratum) throws AbsentInformationException;
/**
* Gets the paths to the source corresponding to the
* declaration of this type. Interpretation of these paths is
* the responsibility of the source repository mechanism.
* <P>
* The returned paths are for the specified stratum
* (see {@link Location} for a description of strata).
* In the reference implementation, for strata which
* do not explicitly specify source path (the Java
* programming language stratum never does), the returned
* strings are the {@link #sourceNames(String)} prefixed by
* the package name of this ReferenceType
* converted to a platform dependent path.
* For example, on a Windows platform,
* <CODE>java.lang.Thread</CODE>
* would return a List containing one element:
* <CODE>"java\lang\Thread.java"</CODE>.
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the declaring type's
* default stratum.
*
* @return a List of String objects each representing a source path
*
* @throws AbsentInformationException if the source names are not
* known.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* AbsentInformationException is always thrown.
*
* @since 1.4
*/
List<String> sourcePaths(String stratum) throws AbsentInformationException;
/**
* Get the source debug extension of this type.
* <p>
* Not all target virtual machines support this operation.
* Use
* {@link VirtualMachine#canGetSourceDebugExtension() canGetSourceDebugExtension()}
* to determine if the operation is supported.
* @return as a string the source debug extension attribute
* @throws AbsentInformationException if the extension is not
* specified
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetSourceDebugExtension() canGetSourceDebugExtension()},
*/
String sourceDebugExtension() throws AbsentInformationException;
/**
* Determines if this type was declared static. Only nested types,
* can be declared static, so <code>false</code> is returned
* for any package-level type, array type, or primitive class.
*
* @return <code>true</code> if this type is static; false otherwise.
*/
boolean isStatic();
/**
* Determines if this type was declared abstract.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is undefined.
*
* @return <code>true</code> if this type is abstract; false otherwise.
*/
boolean isAbstract();
/**
* Determines if this type was declared final.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is always true.
*
* @return <code>true</code> if this type is final; false otherwise.
*/
boolean isFinal();
/**
* Determines if this type has been prepared. See the JVM
* specification for a definition of class preparation.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is undefined.
*
* @return <code>true</code> if this type is prepared; false otherwise.
*/
boolean isPrepared();
/**
* Determines if this type has been verified. See the JVM
* specification for a definition of class verification.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is undefined.
*
* @return <code>true</code> if this type is verified; false otherwise.
*/
boolean isVerified();
/**
* Determines if this type has been initialized. See the JVM
* specification for a definition of class verification.
* For {@link InterfaceType}, this method always returns the
* same value as {@link #isPrepared()}.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is undefined.
*
* @return <code>true</code> if this type is initialized; false otherwise.
*/
boolean isInitialized();
/**
* Determines if initialization failed for this class. See the JVM
* specification for details on class initialization.
* <p>
* For arrays ({@link ArrayType}) and primitive classes,
* the return value is undefined.
*
* @return <code>true</code> if initialization was attempted and
* failed; false otherwise.
*/
boolean failedToInitialize();
/**
* Returns a list containing each {@link Field} declared in this type.
* Inherited fields are not included. Any synthetic fields created
* by the compiler are included in the list.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a list {@link Field} objects; the list has length 0
* if no fields exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Field> fields();
/**
* Returns a list containing each unhidden and unambiguous {@link Field}
* in this type.
* Each field that can be accessed from the class
* or its instances with its simple name is included. Fields that
* are ambiguously multiply inherited or fields that are hidden by
* fields with the same name in a more recently inherited class
* cannot be accessed
* by their simple names and are not included in the returned
* list. All other inherited fields are included.
* See JLS section 8.3 for details.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a List of {@link Field} objects; the list has length
* 0 if no visible fields exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Field> visibleFields();
/**
* Returns a list containing each {@link Field} declared in this type,
* and its superclasses, implemented interfaces, and/or superinterfaces.
* All declared and inherited
* fields are included, regardless of whether they are hidden or
* multiply inherited.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a List of {@link Field} objects; the list has length
* 0 if no fields exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Field> allFields();
/**
* Finds the visible {@link Field} with the given
* non-ambiguous name. This method follows the
* inheritance rules specified in the JLS (8.3.3) to determine
* visibility.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* value is always null.
*
* @param fieldName a String containing the name of desired field.
* @return a {@link Field} object which mirrors the found field, or
* null if there is no field with the given name or if the given
* name is ambiguous.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
Field fieldByName(String fieldName);
/**
* Returns a list containing each {@link Method} declared
* directly in this type.
* Inherited methods are not included. Constructors,
* the initialization method if any, and any synthetic methods created
* by the compiler are included in the list.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a list {@link Method} objects; the list has length 0
* if no methods exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Method> methods();
/**
* Returns a list containing each {@link Method}
* declared or inherited by this type. Methods from superclasses
* or superinterfaces that that have been hidden or overridden
* are not included.
* <p>
* Note that despite this exclusion, multiple inherited methods
* with the same signature can be present in the returned list, but
* at most one can be a member of a {@link ClassType}.
* See JLS section 8.4.6 for details.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a List of {@link Method} objects; the list has length
* 0 if no visible methods exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Method> visibleMethods();
/**
* Returns a list containing each {@link Method} declared in this type,
* and its superclasses, implemented interfaces, and/or superinterfaces.
* All declared and inherited
* methods are included, regardless of whether they are hidden or
* overridden.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a List of {@link Method} objects; the list has length
* 0 if no methods exist.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Method> allMethods();
/**
* Returns a List containing each visible {@link Method} that
* has the given name. This is most commonly used to
* find overloaded methods.
* <p>
* Overridden and hidden methods are not included.
* See JLS (8.4.6) for details.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @param name the name of the method to find.
* @return a List of {@link Method} objects that match the given
* name; the list has length 0 if no matching methods are found.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Method> methodsByName(String name);
/**
* Returns a List containing each visible {@link Method} that
* has the given name and signature.
* The signature string is the
* JNI signature for the target method:
* <ul>
* <li><code>()V</code>
* <li><code>([Ljava/lang/String;)V</code>
* <li><code>(IIII)Z</code>
* </ul>
* This method follows the inheritance rules specified
* in the JLS (8.4.6) to determine visibility.
* <p>
* At most one method in the list is a concrete method and a
* component of {@link ClassType}; any other methods in the list
* are abstract. Use {@link ClassType#concreteMethodByName} to
* retrieve only the matching concrete method.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @param name the name of the method to find.
* @param signature the signature of the method to find
* @return a List of {@link Method} objects that match the given
* name and signature; the list has length 0 if no matching methods
* are found.
* @throws ClassNotPreparedException if this class not yet been
* prepared.
*/
List<Method> methodsByName(String name, String signature);
/**
* Returns a List containing {@link ReferenceType} objects that are
* declared within this type and are currently loaded into the Virtual
* Machine. Both static nested types and non-static nested
* types (that is, inner types) are included. Local inner types
* (declared within a code block somewhere in this reference type) are
* also included in the returned list.
* <p>
* For arrays ({@link ArrayType}) and primitive classes, the returned
* list is always empty.
*
* @return a List of nested {@link ReferenceType} objects; the list
* has 0 length if there are no nested types.
*/
List<ReferenceType> nestedTypes();
/**
* Gets the {@link Value} of a given static {@link Field} in this type.
* The Field must be valid for this type;
* that is, it must be declared in this type, a superclass, a
* superinterface, or an implemented interface.
*
* @param field the field containing the requested value
* @return the {@link Value} of the instance field.
* @throws java.lang.IllegalArgumentException if the field is not valid for
* this object's class.
*/
Value getValue(Field field);
/**
* Returns a map containing the {@link Value} of each
* static {@link Field} in the given list.
* The Fields must be valid for this type;
* that is, they must be declared in this type, a superclass, a
* superinterface, or an implemented interface.
*
* @param fields a list of {@link Field} objects containing the
* requested values.
* @return a Map of the requested {@link Field} objects with
* their {@link Value}.
* @throws java.lang.IllegalArgumentException if any field is not valid for
* this object's class.
* @throws VMMismatchException if a {@link Mirror} argument and this mirror
* do not belong to the same {@link VirtualMachine}.
*/
Map<Field,Value> getValues(List<? extends Field> fields);
/**
* Returns the class object that corresponds to this type in the
* target VM. The VM creates class objects for every kind of
* ReferenceType: classes, interfaces, and array types.
* @return the {@link ClassObjectReference} for this reference type
* in the target VM.
*/
ClassObjectReference classObject();
/**
* Returns a list containing a {@link Location} object
* for each executable source line in this reference type.
* <P>
* This method is equivalent to
* <code>allLineLocations(vm.getDefaultStratum(),null)</code> -
* see {@link #allLineLocations(String,String)}
* for more information.
*
* @throws AbsentInformationException if there is no line
* number information for this class and there are non-native,
* non-abstract executable members of this class.
*
* @throws ClassNotPreparedException if this class not yet
* been prepared.
*/
List<Location> allLineLocations() throws AbsentInformationException;
/**
* Returns a list containing a {@link Location} object
* for each executable source line in this reference type.
* Each location maps a source line to a range of code
* indices.
* The beginning of the range can be determined through
* {@link Location#codeIndex}. The returned list may contain
* multiple locations for a particular line number, if the
* compiler and/or VM has mapped that line to two or more
* disjoint code index ranges. Note that it is possible for
* the same source line to represent different code index
* ranges in <i>different</i> methods.
* <P>
* For arrays ({@link ArrayType}) and primitive classes, the
* returned list is always empty. For interfaces ({@link
* InterfaceType}), the returned list will be non-empty only
* if the interface has executable code in its class
* initialization.
* <P>
* Returned list is for the specified <i>stratum</i>
* (see {@link Location} for a description of strata).
*
* @param stratum The stratum to retrieve information from
* or <code>null</code> for the {@link #defaultStratum()}.
*
* @param sourceName Return locations only within this
* source file or <code>null</code> to return locations.
*
* @return a List of all source line {@link Location} objects.
*
* @throws AbsentInformationException if there is no line
* number information for this class and there are non-native,
* non-abstract executable members of this class.
* Or if <i>sourceName</i> is non-<code>null</code>
* and source name information is not present.
*
* @throws ClassNotPreparedException if this class not yet
* been prepared.
*
* @since 1.4
*/
List<Location> allLineLocations(String stratum, String sourceName)
throws AbsentInformationException;
/**
* Returns a List containing all {@link Location} objects
* that map to the given line number.
* <P>
* This method is equivalent to
* <code>locationsOfLine(vm.getDefaultStratum(), null,
* lineNumber)</code> -
* see {@link
* #locationsOfLine(java.lang.String,java.lang.String,int)}
* for more information.
*
* @param lineNumber the line number
*
* @return a List of all {@link Location} objects that map to
* the given line.
*
* @throws AbsentInformationException if there is no line
* number information for this class.
*
* @throws ClassNotPreparedException if this class not yet
* been prepared.
*
* @see VirtualMachine#getDefaultStratum()
*/
List<Location> locationsOfLine(int lineNumber)
throws AbsentInformationException;
/**
* Returns a List containing all {@link Location} objects
* that map to the given line number.
* <P>
* For arrays ({@link ArrayType}) and primitive classes, the
* returned list is always empty.
* For interfaces ({@link InterfaceType}), the returned list
* will be non-empty only if the interface has executable code
* in its class initialization at the specified line number.
* An empty list will be returned if there is no executable
* code at the specified line number.
* <p>
* Returned list is for the specified <i>stratum</i>
* (see {@link Location} for a description of strata).
*
* @param stratum the stratum to use for comparing line number
* and source name, or <code>null</code> to
* use the {@link #defaultStratum()}.
*
* @param sourceName the source name containing the line
* number, or <code>null</code> to match
* all source names
*
* @param lineNumber the line number
*
* @return a List of all {@link Location} objects that map
* to the given line.
*
* @throws AbsentInformationException if there is no line
* number information for this class.
* Or if <i>sourceName</i> is non-<code>null</code>
* and source name information is not present.
*
* @throws ClassNotPreparedException if this class not yet
* been prepared.
*
* @since 1.4
*/
List<Location> locationsOfLine(String stratum,
String sourceName,
int lineNumber)
throws AbsentInformationException;
/**
* Return the available strata for this reference type.
* <P>
* See the {@link Location} for a description of strata.
*
* @return List of <CODE>java.lang.String</CODE>, each
* representing a stratum
*
* @since 1.4
*/
List<String> availableStrata();
/**
* Returns the default stratum for this reference type.
* This value is specified in the class file and cannot
* be set by the user. If the class file does not
* specify a default stratum the base stratum
* (<code>"Java"</code>) will be returned.
* <P>
* See the {@link Location} for a description of strata.
*
* @since 1.4
*/
String defaultStratum();
/**
* Returns instances of this ReferenceType.
* Only instances that are reachable for the purposes of garbage collection
* are returned.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetInstanceInfo()}
* to determine if the operation is supported.
*
* @see VirtualMachine#instanceCounts(List)
* @see ObjectReference#referringObjects(long)
*
* @param maxInstances the maximum number of instances to return.
* Must be non-negative. If zero, all instances are returned.
* @return a List of {@link ObjectReference} objects. If there are
* no instances of this ReferenceType, a zero-length list is returned.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetInstanceInfo() canGetInstanceInfo()}
* @throws java.lang.IllegalArgumentException if maxInstances is less
* than zero.
* @since 1.6
*/
List<ObjectReference> instances(long maxInstances);
/**
* Compares the specified Object with this ReferenceType for equality.
*
* @return true if the Object is a {@link ReferenceType}, if the
* ReferenceTypes belong to the same VM, and if they mirror classes
* which correspond to the same instance of java.lang.Class in that VM.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this ObjectReference.
*
* @return the integer hash code
*/
int hashCode();
/**
* Returns the class major version number, as defined in the class file format
* of the Java Virtual Machine Specification.
*
* For arrays ({@link ArrayType}) and primitive classes,
* the returned major version number value is zero.
*
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetClassFileVersion()}
* to determine if the operation is supported.
*
* @return the major version number of the class.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetClassFileVersion() canGetClassFileVersion()}
*
* @since 1.6
*/
int majorVersion();
/**
* Returns the class minor version number, as defined in the class file format
* of the Java Virtual Machine Specification.
*
* For arrays ({@link ArrayType}) and primitive classes,
* the returned minor version number value is zero.
*
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetClassFileVersion()}
* to determine if the operation is supported.
*
* @return the minor version number of the class.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetClassFileVersion() canGetClassFileVersion()}
*
* @since 1.6
*/
int minorVersion();
/**
* Returns the number of entries in the constant pool plus one.
* This corresponds to the constant_pool_count item of the Class File Format
* in the Java Virtual Machine Specification.
*
* For arrays ({@link ArrayType}) and primitive classes,
* the returned constant pool count value is zero.
*
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetConstantPool()}
* to determine if the operation is supported.
*
* @return total number of constant pool entries for a class plus one.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetConstantPool() canGetConstantPool()}
*
* @see #constantPool()
* @since 1.6
*/
int constantPoolCount();
/**
* Returns the raw bytes of the constant pool in the format of the
* constant_pool item of the Class File Format in the Java Virtual
* Machine Specification. The format of the constant pool may
* differ between versions of the Class File Format, so, the
* minor and major class version numbers should be checked for
* compatibility.
*
* For arrays ({@link ArrayType}) and primitive classes,
* a zero length byte array is returned.
*
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetConstantPool()}
* to determine if the operation is supported.
*
* @return the raw bytes of constant pool.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetConstantPool() canGetConstantPool()}
*
* @see #constantPoolCount()
* @since 1.6
*/
byte[] constantPool();
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive <code>short</code> values
* accessed in the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see LongValue
*
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ShortType extends PrimitiveType {
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>short</code> value in
* the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ShortValue extends PrimitiveValue, Comparable<ShortValue> {
/**
* Returns this ShortValue as a short.
*
* @return the <code>short</code> mirrored by this object.
*/
short value();
/**
* Compares the specified Object with this ShortValue for equality.
*
* @return true if the Object is a ShortValue and if applying "=="
* to the two mirrored primitives would evaluate to true; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this ShortValue.
*
* @return the integer hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,240 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
import java.util.Map;
/**
* The state of one method invocation on a thread's call stack.
* As a thread executes, stack frames are pushed and popped from
* its call stack as methods are invoked and then return. A StackFrame
* mirrors one such frame from a target VM at some point in its
* thread's execution. The call stack is, then, simply a List of
* StackFrame objects. The call stack can be obtained any time a thread
* is suspended through a call to {@link ThreadReference#frames}
* <p>
* StackFrames provide access to a method's local variables and their
* current values.
* <p>
* The lifetime of a StackFrame is very limited. It is available only
* for suspended threads and becomes invalid once its thread is resumed.
* <p>
* Any method on <code>StackFrame</code> which
* takes <code>StackFrame</code> as an parameter may throw
* {@link com.sun.jdi.VMDisconnectedException} if the target VM is
* disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
* available to be read from the {@link com.sun.jdi.event.EventQueue}.
* <p>
* Any method on <code>StackFrame</code> which
* takes <code>StackFrame</code> as an parameter may throw
* {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface StackFrame extends Mirror, Locatable {
/**
* Returns the {@link Location} of the current instruction in the frame.
* The method for which this frame was created can also be accessed
* through the returned location.
* For the top frame in the stack, this location identifies the
* next instruction to be executed. For all other frames, this
* location identifies the instruction that caused the next frame's
* method to be invoked.
* If the frame represents a native method invocation, the returned
* location indicates the class and method, but the code index will
* not be valid (-1).
*
* @return the {@link Location} of the current instruction.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
*/
Location location();
/**
* Returns the thread under which this frame's method is running.
*
* @return a {@link ThreadReference} which mirrors the frame's thread.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
*/
ThreadReference thread();
/**
* Returns the value of 'this' for the current frame.
* The {@link ObjectReference} for 'this' is only available for
* non-native instance methods.
*
* @return an {@link ObjectReference}, or null if the frame represents
* a native or static method.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
*/
ObjectReference thisObject();
/**
* Returns a list containing each {@link LocalVariable}
* that can be accessed from this frame's location.
* <p>
* Visibility is based on the code index of the current instruction of
* this StackFrame. Each variable has a range of byte code indices in which
* it is accessible.
* If this stack frame's method
* matches this variable's method and if the code index of this
* StackFrame is within the variable's byte code range, the variable is
* visible.
* <p>
* A variable's byte code range is at least as large as the scope of
* that variable, but can continue beyond the end of the scope under
* certain circumstances:
* <ul>
* <li>the compiler/VM does not immediately reuse the variable's slot.
* <li>the compiler/VM is implemented to report the extended range that
* would result from the item above.
* </ul>
* The advantage of an extended range is that variables from recently
* exited scopes may remain available for examination (this is especially
* useful for loop indices). If, as a result of the extensions above,
* the current frame location is contained within the range
* of multiple local variables of the same name, the variable with the
* highest-starting range is chosen for the returned list.
*
* @return the list of {@link LocalVariable} objects currently visible;
* the list will be empty if there are no visible variables;
* specifically, frames in native methods will always return a
* zero-length list.
* @throws AbsentInformationException if there is no local variable
* information for this method.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
* @throws NativeMethodException if the current method is native.
*/
List<LocalVariable> visibleVariables() throws AbsentInformationException;
/**
* Finds a {@link LocalVariable} that matches the given name and is
* visible at the current frame location.
* See {@link #visibleVariables} for more information on visibility.
*
* @param name the variable name to find
* @return the matching {@link LocalVariable}, or null if there is no
* visible variable with the given name; frames in native methods
* will always return null.
* @throws AbsentInformationException if there is no local variable
* information for this method.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
* @throws NativeMethodException if the current method is native.
*/
LocalVariable visibleVariableByName(String name) throws AbsentInformationException;
/**
* Gets the {@link Value} of a {@link LocalVariable} in this frame.
* The variable must be valid for this frame's method and visible
* according to the rules described in {@link #visibleVariables}.
*
* @param variable the {@link LocalVariable} to be accessed
* @return the {@link Value} of the instance field.
* @throws java.lang.IllegalArgumentException if the variable is
* either invalid for this frame's method or not visible.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
*/
Value getValue(LocalVariable variable);
/**
* Returns the values of multiple local variables in this frame.
* Each variable must be valid for this frame's method and visible
* according to the rules described in {@link #visibleVariables}.
*
* @param variables a list of {@link LocalVariable} objects to be accessed
* @return a map associating each {@link LocalVariable} with
* its {@link Value}
* @throws java.lang.IllegalArgumentException if any variable is
* either invalid for this frame's method or not visible.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
*/
Map<LocalVariable,Value> getValues(List<? extends LocalVariable> variables);
/**
* Sets the {@link Value} of a {@link LocalVariable} in this frame.
* The variable must be valid for this frame's method and visible
* according to the rules described in {@link #visibleVariables}.
* <p>
* Object values must be assignment compatible with the variable type
* (This implies that the variable type must be loaded through the
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the variable type or must be
* convertible to the variable type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
*
* @param variable the field containing the requested value
* @param value the new value to assign
* @throws java.lang.IllegalArgumentException if the field is not valid for
* this object's class.
* @throws InvalidTypeException if the value's type does not match
* the variable's type.
* @throws ClassNotLoadedException if the variable type has not yet been loaded
* through the appropriate class loader.
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void setValue(LocalVariable variable, Value value)
throws InvalidTypeException, ClassNotLoadedException;
/**
* Returns the values of all arguments in this frame. Values are
* returned even if no local variable information is present.
*
* @return a list containing a {@link Value} object for each argument
* to this frame, in the order in which the arguments were
* declared. If the method corresponding to this frame has
* no arguments, an empty list is returned.
*
* @throws InvalidStackFrameException if this stack frame has become
* invalid. Once the frame's thread is resumed, the stack frame is
* no longer valid.
* @since 1.6
*/
List<Value> getArgumentValues();
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* A string object from the target VM.
* A StringReference is an {@link ObjectReference} with additional
* access to string-specific information from the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface StringReference extends ObjectReference {
/**
* Returns the StringReference as a String. The returned string
* is the equivalent of the mirrored string, but is an entity in the
* client VM and can be manipulated like any other string.
*
* @return the string value.
*/
String value();
}

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A thread group object from the target VM.
* A ThreadGroupReference is an {@link ObjectReference} with additional
* access to threadgroup-specific information from the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ThreadGroupReference extends ObjectReference {
/**
* Returns the name of this thread group.
*
* @return the string containing the thread group name.
*/
String name();
/**
* Returns the parent of this thread group.
*
* @return a {@link ThreadGroupReference} mirroring the parent of this
* thread group in the target VM, or null if this is a top-level
* thread group.
*/
ThreadGroupReference parent();
/**
* Suspends all threads in this thread group. Each thread
* in this group and in all of its subgroups will be
* suspended as described in {@link ThreadReference#suspend}.
* This is not guaranteed to be an atomic
* operation; if the target VM is not interrupted at the time
* this method is
* called, it is possible that new threads will be created
* between the time that threads are enumerated and all of them
* have been suspended.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void suspend();
/**
* Resumes all threads in this thread group. Each thread
* in this group and in all of its subgroups will be
* resumed as described in {@link ThreadReference#resume}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void resume();
/**
* Returns a List containing a {@link ThreadReference} for each live thread
* in this thread group. Only the live threads in this immediate thread group
* (and not its subgroups) are returned. A thread is alive if it
* has been started and has not yet been stopped.
*
* @return a List of {@link ThreadReference} objects mirroring the
* live threads from this thread group in the target VM.
*/
List<ThreadReference> threads();
/**
* Returns a List containing each active {@link ThreadGroupReference} in this
* thread group. Only the active thread groups in this immediate thread group
* (and not its subgroups) are returned.
* See <a href="{@docRoot}/../../../../api/java/lang/ThreadGroup.html">java.lang.ThreadGroup</a>
* for information about 'active' ThreadGroups.
* @return a List of {@link ThreadGroupReference} objects mirroring the
* active thread groups from this thread group in the target VM.
*/
List<ThreadGroupReference> threadGroups();
}

View File

@@ -0,0 +1,473 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import java.util.List;
/**
* A thread object from the target VM.
* A ThreadReference is an {@link ObjectReference} with additional
* access to thread-specific information from the target VM.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface ThreadReference extends ObjectReference {
/** Thread status is unknown */
public final int THREAD_STATUS_UNKNOWN =-1;
/** Thread has completed execution */
public final int THREAD_STATUS_ZOMBIE = 0;
/** Thread is runnable */
public final int THREAD_STATUS_RUNNING = 1;
/** Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */
public final int THREAD_STATUS_SLEEPING = 2;
/** Thread is waiting on a java monitor */
public final int THREAD_STATUS_MONITOR = 3;
/** Thread is waiting - Object.wait() or JVM_MonitorWait() was called */
public final int THREAD_STATUS_WAIT = 4;
/** Thread has not yet been started */
public final int THREAD_STATUS_NOT_STARTED = 5;
/**
* Returns the name of this thread.
*
* @return the string containing the thread name.
*/
String name();
/**
* Suspends this thread. The thread can be resumed through
* {@link #resume} or resumed with other threads through
* {@link VirtualMachine#resume}.
* <p>
* Unlike {@link java.lang.Thread#suspend},
* suspends of both the virtual machine and individual threads are
* counted. Before a thread will run again, it must be resumed
* (through {@link #resume} or {@link ThreadReference#resume})
* the same number of times it has been suspended.
* <p>
* Suspending single threads with this method has the same dangers
* as {@link java.lang.Thread#suspend()}. If the suspended thread
* holds a monitor needed by another running thread, deadlock is
* possible in the target VM (at least until the suspended thread
* is resumed again).
* <p>
* The suspended thread is guaranteed to remain suspended until
* resumed through one of the JDI resume methods mentioned above;
* the application in the target VM cannot resume the suspended thread
* through {@link java.lang.Thread#resume}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void suspend();
/**
* Resumes this thread. If this thread was not previously suspended
* through {@link #suspend} or through {@link VirtualMachine#suspend},
* or because of a SUSPEND_ALL or SUSPEND_EVENT_THREAD event, then
* invoking this method has no effect. Otherwise, the count of pending
* suspends on this thread is decremented. If it is decremented to 0,
* the thread will continue to execute.
* Note: the normal way to resume from an event related suspension is
* via {@link com.sun.jdi.event.EventSet#resume}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void resume();
/**
* Returns the number of pending suspends for this thread. See
* {@link #suspend} for an explanation of counted suspends.
* @return pending suspend count as an integer
*/
int suspendCount();
/**
* Stops this thread with an asynchronous exception.
* A debugger thread in the target VM will stop this thread
* with the given {@link java.lang.Throwable} object.
*
* @param throwable the asynchronous exception to throw.
* @throws InvalidTypeException if <code>throwable</code> is not
* an instance of java.lang.Throwable in the target VM.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
* @see java.lang.Thread#stop(Throwable)
*/
void stop(ObjectReference throwable) throws InvalidTypeException;
/**
* Interrupts this thread unless the thread has been suspended by the
* debugger.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @see java.lang.Thread#interrupt()
*/
void interrupt();
/**
* Returns the thread's status. If the thread is not suspended the
* thread's current status is returned. If the thread is suspended, the
* thread's status before the suspension is returned (or
* {@link #THREAD_STATUS_UNKNOWN} if this information is not available.
* {@link #isSuspended} can be used to determine if the thread has been
* suspended.
*
* @return one of
* {@link #THREAD_STATUS_UNKNOWN},
* {@link #THREAD_STATUS_ZOMBIE},
* {@link #THREAD_STATUS_RUNNING},
* {@link #THREAD_STATUS_SLEEPING},
* {@link #THREAD_STATUS_MONITOR},
* {@link #THREAD_STATUS_WAIT},
* {@link #THREAD_STATUS_NOT_STARTED},
*/
int status();
/**
* Determines whether the thread has been suspended by the
* the debugger.
*
* @return <code>true</code> if the thread is currently suspended;
* <code>false</code> otherwise.
*/
boolean isSuspended();
/**
* Determines whether the thread is suspended at a breakpoint.
*
* @return <code>true</code> if the thread is currently stopped at
* a breakpoint; <code>false</code> otherwise.
*/
boolean isAtBreakpoint();
/**
* Returns this thread's thread group.
* @return a {@link ThreadGroupReference} that mirrors this thread's
* thread group in the target VM.
*/
ThreadGroupReference threadGroup();
/**
* Returns the number of stack frames in the thread's current
* call stack.
* The thread must be suspended (normally through an interruption
* to the VM) to get this information, and
* it is only valid until the thread is resumed again.
*
* @return an integer frame count
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
*/
int frameCount() throws IncompatibleThreadStateException;
/**
* Returns a List containing each {@link StackFrame} in the
* thread's current call stack.
* The thread must be suspended (normally through an interruption
* to the VM) to get this information, and
* it is only valid until the thread is resumed again.
*
* @return a List of {@link StackFrame} with the current frame first
* followed by each caller's frame.
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
*/
List<StackFrame> frames() throws IncompatibleThreadStateException;
/**
* Returns the {@link StackFrame} at the given index in the
* thread's current call stack. Index 0 retrieves the current
* frame; higher indices retrieve caller frames.
* The thread must be suspended (normally through an interruption
* to the VM) to get this information, and
* it is only valid until the thread is resumed again.
*
* @param index the desired frame
* @return the requested {@link StackFrame}
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
* @throws java.lang.IndexOutOfBoundsException if the index is greater than
* or equal to {@link #frameCount} or is negative.
*/
StackFrame frame(int index) throws IncompatibleThreadStateException;
/**
* Returns a List containing a range of {@link StackFrame} mirrors
* from the thread's current call stack.
* The thread must be suspended (normally through an interruption
* to the VM) to get this information, and
* it is only valid until the thread is resumed again.
*
* @param start the index of the first frame to retrieve.
* Index 0 represents the current frame.
* @param length the number of frames to retrieve
* @return a List of {@link StackFrame} with the current frame first
* followed by each caller's frame.
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
* @throws IndexOutOfBoundsException if the specified range is not
* within the range of stack frame indicies.
* That is, the exception is thrown if any of the following are true:
* <pre> start &lt; 0
* start &gt;= {@link #frameCount}
* length &lt; 0
* (start+length) &gt; {@link #frameCount}</pre>
*/
List<StackFrame> frames(int start, int length)
throws IncompatibleThreadStateException;
/**
* Returns a List containing an {@link ObjectReference} for
* each monitor owned by the thread.
* A monitor is owned by a thread if it has been entered
* (via the synchronized statement or entry into a synchronized
* method) and has not been relinquished through {@link Object#wait}.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetOwnedMonitorInfo()}
* to determine if the operation is supported.
*
* @return a List of {@link ObjectReference} objects. The list
* has zero length if no monitors are owned by this thread.
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation.
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
*/
List<ObjectReference> ownedMonitors()
throws IncompatibleThreadStateException;
/**
* Returns a List containing a {@link MonitorInfo} object for
* each monitor owned by the thread.
* A monitor is owned by a thread if it has been entered
* (via the synchronized statement or entry into a synchronized
* method) and has not been relinquished through {@link Object#wait}.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetMonitorFrameInfo()}
* to determine if the operation is supported.
*
* @return a List of {@link MonitorInfo} objects. The list
* has zero length if no monitors are owned by this thread.
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation.
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
*
* @since 1.6
*/
List<MonitorInfo> ownedMonitorsAndFrames()
throws IncompatibleThreadStateException;
/**
* Returns an {@link ObjectReference} for the monitor, if any,
* for which this thread is currently waiting.
* The thread can be waiting for a monitor through entry into a
* synchronized method, the synchronized statement, or
* {@link Object#wait}. The {@link #status} method can be used
* to differentiate between the first two cases and the third.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetCurrentContendedMonitor()}
* to determine if the operation is supported.
*
* @return the {@link ObjectReference} corresponding to the
* contended monitor, or null if it is not waiting for a monitor.
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation.
* @throws IncompatibleThreadStateException if the thread is
* not suspended in the target VM
*/
ObjectReference currentContendedMonitor() throws IncompatibleThreadStateException;
/**
* Pop stack frames.
* <P>
* All frames up to and including the <CODE>frame</CODE> are
* popped off the stack.
* The frame previous to the parameter <CODE>frame</CODE>
* will become the current frame.
* <P>
* After this operation, this thread will be
* suspended at the invoke instruction of the target method
* that created <CODE>frame</CODE>.
* The <CODE>frame</CODE>'s method can be reentered with a step into
* the instruction.
* <P>
* The operand stack is restored, however, any changes
* to the arguments that occurred in the called method, remain.
* For example, if the method <CODE>foo</CODE>:
* <PRE>
* void foo(int x) {
* System.out.println("Foo: " + x);
* x = 4;
* System.out.println("pop here");
* }
* </PRE>
* was called with <CODE>foo(7)</CODE> and <CODE>foo</CODE>
* is popped at the second <CODE>println</CODE> and resumed,
* it will print: <CODE>Foo: 4</CODE>.
* <P>
* Locks acquired by a popped frame are released when it
* is popped. This applies to synchronized methods that
* are popped, and to any synchronized blocks within them.
* <P>
* Finally blocks are not executed.
* <P>
* No aspect of state, other than this thread's execution point and
* locks, is affected by this call. Specifically, the values of
* fields are unchanged, as are external resources such as
* I/O streams. Additionally, the target program might be
* placed in a state that is impossible with normal program flow;
* for example, order of lock acquisition might be perturbed.
* Thus the target program may
* proceed differently than the user would expect.
* <P>
* The specified thread must be suspended.
* <P>
* All <code>StackFrame</code> objects for this thread are
* invalidated.
* <P>
* No events are generated by this method.
* <P>
* None of the frames through and including the frame for the caller
* of <i>frame</i> may be native.
* <P>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canPopFrames() VirtualMachine.canPopFrames()}
* to determine if the operation is supported.
*
* @param frame Stack frame to pop. <CODE>frame</CODE> is on this
* thread's call stack.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canPopFrames() VirtualMachine.canPopFrames()}.
*
* @throws IncompatibleThreadStateException if this
* thread is not suspended.
*
* @throws java.lang.IllegalArgumentException if <CODE>frame</CODE>
* is not on this thread's call stack.
*
* @throws NativeMethodException if one of the frames that would be
* popped is that of a native method or if the frame previous to
* <i>frame</i> is native.
*
* @throws InvalidStackFrameException if <CODE>frame</CODE> has become
* invalid. Once this thread is resumed, the stack frame is
* no longer valid. This exception is also thrown if there are no
* more frames.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @since 1.4 */
void popFrames(StackFrame frame) throws IncompatibleThreadStateException;
/**
* Force a method to return before it reaches a return
* statement.
* <p>
* The method which will return early is referred to as the
* called method. The called method is the current method (as
* defined by the Frames section in the Java Virtual Machine
* Specification) for the specified thread at the time this
* method is called.
* <p>
* The thread must be suspended.
* The return occurs when execution of Java programming
* language code is resumed on this thread. Between the call to
* this method and resumption of thread execution, the
* state of the stack is undefined.
* <p>
* No further instructions are executed in the called
* method. Specifically, finally blocks are not executed. Note:
* this can cause inconsistent states in the application.
* <p>
* A lock acquired by calling the called method (if it is a
* synchronized method) and locks acquired by entering
* synchronized blocks within the called method are
* released. Note: this does not apply to native locks or
* java.util.concurrent.locks locks.
* <p>
* Events, such as MethodExit, are generated as they would be in
* a normal return.
* <p>
* The called method must be a non-native Java programming
* language method. Forcing return on a thread with only one
* frame on the stack causes the thread to exit when resumed.
* <p>
* The <code>value</code> argument is the value that the
* method is to return.
* If the return type of the method is void, then value must
* be a {@link VoidValue VoidValue}.
* Object values must be assignment compatible with the method return type
* (This implies that the method return type must be loaded through the
* enclosing class's class loader). Primitive values must be
* either assignment compatible with the method return type or must be
* convertible to the variable type without loss of information.
* See JLS section 5.2 for more information on assignment
* compatibility.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canForceEarlyReturn()}
* to determine if the operation is supported.
*
* @param value the value the method is to return.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetInstanceInfo() canForceEarlyReturn()}
*
* @throws IncompatibleThreadStateException if this
* thread is not suspended.
*
* @throws NativeMethodException if the frame to be returned from
* is that of a native method.
*
* @throws InvalidStackFrameException if there are no frames.
*
* @throws InvalidTypeException if the value's type does not match
* the method's return type.
*
* @throws ClassNotLoadedException if the method's return type has not yet
* been loaded through the appropriate class loader.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @since 1.6
*/
void forceEarlyReturn(Value value) throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException;
}

View File

@@ -0,0 +1,150 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The mirror for a type in the target VM.
* This interface is the root of a type hierarchy encompassing primitive
* types and reference types.
* <P>
* A Type may be used to represent a run-time type:
* <BLOCKQUOTE>
* {@link Value}.type()
* </BLOCKQUOTE>
* or a compile-time type:
* <BLOCKQUOTE>
* {@link Field#type()} <BR>
* {@link Method#returnType()} <BR>
* {@link Method#argumentTypes()} <BR>
* {@link LocalVariable#type()} <BR>
* {@link ArrayType#componentType()}
* </BLOCKQUOTE>
* <P>
* The following table illustrates which subinterfaces of Type
* are used to mirror types in the target VM --
* <TABLE BORDER=1 SUMMARY="Maps each type declared in target to a mirrored
* instance of a subinterface of PrimitiveType or ReferenceType">
* <TR BGCOLOR="#EEEEFF">
* <TH id="primtype" colspan=3>Subinterfaces of {@link PrimitiveType}</TH>
* <TR BGCOLOR="#EEEEFF">
* <TH id="declared" align="left" colspan=2>Type declared in target as</TH>
* <TH id="mirrored" align="left">Is mirrored as an instance of</TH>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>boolean</CODE></TD>
* <TD headers="primtype mirrored"> {@link BooleanType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>byte</CODE></TD>
* <TD headers="primtype mirrored">{@link ByteType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>char</CODE></TD>
* <TD headers="primtype mirrored">{@link CharType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>double</CODE></TD>
* <TD headers="primtype mirrored">{@link DoubleType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>float</CODE></TD>
* <TD headers="primtype mirrored">{@link FloatType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>int</CODE></TD>
* <TD headers="primtype mirrored">{@link IntegerType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>long</CODE></TD>
* <TD headers="primtype mirrored">{@link LongType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>short</CODE></TD>
* <TD headers="primtype mirrored">{@link ShortType}</TD>
* <TR>
* <TD headers="primtype declared" colspan=2><CODE>void</CODE></TD>
* <TD headers="primtype mirrored">{@link VoidType}</TD>
* <TR BGCOLOR="#EEEEFF">
* <TH id="reftype" colspan=3>Subinterfaces of {@link ReferenceType}</TH>
* <TR BGCOLOR="#EEEEFF">
* <TH id="declared2" align="left">Type declared in target as</TH>
* <TH id="example2" align="left">For example</TH>
* <TH id="mirrored2" align="left">Is mirrored as an instance of</TH>
* <TR>
* <TD headers="reftype declared2"><I>a class</I></TD>
* <TD headers="reftype example2"><CODE>Date</CODE></TD>
* <TD headers="reftype mirrored2">{@link ClassType}</TD>
* <TR>
* <TD headers="reftype declared2"><I>an interface</I></TD>
* <TD headers="reftype example2"><CODE>Runnable</CODE></TD>
* <TD headers="reftype mirrored2">{@link InterfaceType}</TD>
* <TR>
* <TD headers="reftype declared2"><I>an array</I></TD>
* <TD headers="reftype example2">&nbsp;</TD>
* <TD headers="reftype mirrored2">{@link ArrayType}</TD>
* <TR>
* <TD headers="reftype declared2"><I>an array</I></TD>
* <TD headers="reftype example2"><CODE>int[]</CODE></TD>
* <TD headers="reftype mirrored2">{@link ArrayType} whose
* {@link ArrayType#componentType() componentType()} is
* {@link IntegerType}</TD>
* <TR>
* <TD headers="reftype declared2"><I>an array</I></TD>
* <TD headers="reftype example2"><CODE>Date[]</CODE></TD>
* <TD headers="reftype mirrored2">{@link ArrayType} whose
* {@link ArrayType#componentType() componentType()} is
* {@link ClassType}</TD>
* <TR>
* <TD headers="reftype declared2"><I>an array</I></TD>
* <TD headers="reftype example2"><CODE>Runnable[]</CODE></TD>
* <TD headers="reftype mirrored2">{@link ArrayType} whose
* {@link ArrayType#componentType() componentType()} is
* {@link InterfaceType}</TD>
* </TABLE>
*
* @see PrimitiveType Subinterface PrimitiveType
* @see ReferenceType Subinterface ReferenceType
* @see Value Value - for relationship between Type and Value
* @see Field#type() Field.type() - for usage examples
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Type extends Mirror {
/**
* Returns the JNI-style signature for this type.
* <p>
* For primitive classes
* the returned signature is the signature of the corresponding primitive
* type; for example, "I" is returned as the signature of the class
* represented by {@link java.lang.Integer#TYPE}.
*
* @see <a href="doc-files/signature.html">Type Signatures</a>
* @return the string containing the type signature.
*/
String signature();
/**
* @return a text representation of this type.
*/
String name();
}

View File

@@ -0,0 +1,130 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* An entity declared within a user defined
* type (class or interface).
* This interface is the root of the type
* component hierarchy which
* includes {@link Field} and {@link Method}.
* Type components of the same name declared in different classes
* (including those related by inheritance) have different
* TypeComponent objects.
* TypeComponents can be used alone to retrieve static information
* about their declaration, or can be used in conjunction with a
* {@link ReferenceType} or {@link ObjectReference} to access values
* or invoke, as applicable.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface TypeComponent extends Mirror, Accessible {
/**
* Gets the name of this type component.
* <P>
* Note: for fields, this is the field name; for methods,
* this is the method name; for constructors, this is &lt;init&gt;;
* for static initializers, this is &lt;clinit&gt;.
*
* @return a string containing the name.
*/
String name();
/**
* Gets the JNI-style signature for this type component. The
* signature is encoded type information as defined
* in the JNI documentation. It is a convenient, compact format for
* for manipulating type information internally, not necessarily
* for display to an end user. See {@link Field#typeName} and
* {@link Method#returnTypeName} for ways to help get a more readable
* representation of the type.
*
* @see <a href="doc-files/signature.html">Type Signatures</a>
* @return a string containing the signature
*/
String signature();
/**
* Gets the generic signature for this TypeComponent if there is one.
* Generic signatures are described in the
* <cite>The Java&trade; Virtual Machine Specification</cite>.
*
* @return a string containing the generic signature, or <code>null</code>
* if there is no generic signature.
*
* @since 1.5
*/
String genericSignature();
/**
* Returns the type in which this component was declared. The
* returned {@link ReferenceType} mirrors either a class or an
* interface in the target VM.
*
* @return a {@link ReferenceType} for the type that declared
* this type component.
*/
ReferenceType declaringType();
/**
* Determines if this TypeComponent is static.
* Return value is undefined for constructors and static initializers.
*
* @return <code>true</code> if this type component was declared
* static; false otherwise.
*/
boolean isStatic();
/**
* Determines if this TypeComponent is final.
* Return value is undefined for constructors and static initializers.
*
* @return <code>true</code> if this type component was declared
* final; false otherwise.
*/
boolean isFinal();
/**
* Determines if this TypeComponent is synthetic. Synthetic members
* are generated by the compiler and are not present in the source
* code for the containing class.
* <p>
* Not all target VMs support this query. See
* {@link VirtualMachine#canGetSyntheticAttribute} to determine if the
* operation is supported.
*
* @return <code>true</code> if this type component is synthetic;
* <code>false</code> otherwise.
* @throws java.lang.UnsupportedOperationException if the target
* VM cannot provide information on synthetic attributes.
*/
boolean isSynthetic();
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the operation is invalid because it would
* modify the VM and the VM is read-only. See {@link VirtualMachine#canBeModified()}.
*
* @author Jim Holmlund
* @since 1.5
*/
@jdk.Exported
public class VMCannotBeModifiedException extends UnsupportedOperationException {
private static final long serialVersionUID = -4063879815130164009L;
public VMCannotBeModifiedException() {
super();
}
public VMCannotBeModifiedException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Unchecked exception thrown to indicate that the
* requested operation cannot be
* completed because there is no longer a connection to the target VM.
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
public VMDisconnectedException() {
super();
}
public VMDisconnectedException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the a mirror from one target VM is being
* combined with a mirror from another target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class VMMismatchException extends RuntimeException {
private static final long serialVersionUID = 289169358790459564L;
public VMMismatchException() {
super();
}
public VMMismatchException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Thrown to indicate that the requested operation cannot be
* completed because the target VM has run out of memory.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class VMOutOfMemoryException extends RuntimeException {
private static final long serialVersionUID = 71504228548910686L;
public VMOutOfMemoryException() {
super();
}
public VMOutOfMemoryException(String s) {
super(s);
}
}

View File

@@ -0,0 +1,181 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The mirror for a value in the target VM.
* This interface is the root of a
* value hierarchy encompassing primitive values and object values.
* <P>
* Some examples of where values may be accessed:
* <BLOCKQUOTE><TABLE SUMMARY="layout">
* <TR>
* <TD>{@link ObjectReference#getValue(com.sun.jdi.Field)
* ObjectReference.getValue(Field)}
* <TD>- value of a field
* <TR>
* <TD>{@link StackFrame#getValue(com.sun.jdi.LocalVariable)
* StackFrame.getValue(LocalVariable)}
* <TD>- value of a variable
* <TR>
* <TD>{@link VirtualMachine#mirrorOf(double)
* VirtualMachine.mirrorOf(double)}
* <TD>- created in the target VM by the JDI client
* <TR>
* <TD>{@link com.sun.jdi.event.ModificationWatchpointEvent#valueToBe()
* ModificationWatchpointEvent.valueToBe()}
* <TD>- returned with an event
* </TABLE></BLOCKQUOTE>
* <P>
* The following table illustrates which subinterfaces of Value
* are used to mirror values in the target VM --
* <TABLE BORDER=1 SUMMARY="Maps each kind of value to a mirrored
* instance of a subinterface of Value">
* <TR BGCOLOR="#EEEEFF">
* <TH id="primval" colspan=4>Subinterfaces of {@link PrimitiveValue}</TH>
* <TR BGCOLOR="#EEEEFF">
* <TH id="kind" align="left">Kind of value</TH>
* <TH id="example" align="left">For example -<br>expression in target</TH>
* <TH id="mirrored" align="left">Is mirrored as an<br>instance of</TH>
* <TH id="type" align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
* <TR>
* <TD headers="primval kind"> a boolean</TD>
* <TD headers="primval example"> <CODE>true</CODE></TD>
* <TD headers="primval mirrored"> {@link BooleanValue}</TD>
* <TD headers="primval type"> {@link BooleanType}</TD>
* <TR>
* <TD headers="primval kind"> a byte</TD>
* <TD headers="primval example"> <CODE>(byte)4</CODE></TD>
* <TD headers="primval mirrored"> {@link ByteValue}</TD>
* <TD headers="primval type"> {@link ByteType}</TD>
* <TR>
* <TD headers="primval kind"> a char</TD>
* <TD headers="primval example"> <CODE>'a'</CODE></TD>
* <TD headers="primval mirrored"> {@link CharValue}</TD>
* <TD headers="primval type"> {@link CharType}</TD>
* <TR>
* <TD headers="primval kind"> a double</TD>
* <TD headers="primval example"> <CODE>3.1415926</CODE></TD>
* <TD headers="primval mirrored"> {@link DoubleValue}</TD>
* <TD headers="primval type"> {@link DoubleType}</TD>
* <TR>
* <TD headers="primval kind"> a float</TD>
* <TD headers="primval example"> <CODE>2.5f</CODE></TD>
* <TD headers="primval mirrored"> {@link FloatValue}</TD>
* <TD headers="primval type"> {@link FloatType}</TD>
* <TR>
* <TD headers="primval kind"> an int</TD>
* <TD headers="primval example"> <CODE>22</CODE></TD>
* <TD headers="primval mirrored"> {@link IntegerValue}</TD>
* <TD headers="primval type"> {@link IntegerType}</TD>
* <TR>
* <TD headers="primval kind"> a long</TD>
* <TD headers="primval example"> <CODE>1024L</CODE></TD>
* <TD headers="primval mirrored"> {@link LongValue}</TD>
* <TD headers="primval type"> {@link LongType}</TD>
* <TR>
* <TD headers="primval kind"> a short</TD>
* <TD headers="primval example"> <CODE>(short)12</CODE></TD>
* <TD headers="primval mirrored"> {@link ShortValue}</TD>
* <TD headers="primval type"> {@link ShortType}</TD>
* <TR>
* <TD headers="primval kind"> a void</TD>
* <TD headers="primval example"> <CODE>&nbsp;</CODE></TD>
* <TD headers="primval mirrored"> {@link VoidValue}</TD>
* <TD headers="primval type"> {@link VoidType}</TD>
* <TR BGCOLOR="#EEEEFF">
* <TH id="objref" colspan=4>Subinterfaces of {@link ObjectReference}</TH>
* <TR BGCOLOR="#EEEEFF">
* <TH id="kind2" align="left">Kind of value</TH>
* <TH id="example2" align="left">For example -<br>expression in target</TH>
* <TH id="mirrored2" align="left">Is mirrored as an<br>instance of</TH>
* <TH id="type2" align="left">{@link Type} of value<br>{@link #type() Value.type()}</TH>
* <TR>
* <TD headers="objref kind2"> a class instance</TD>
* <TD headers="objref example2"> <CODE>this</CODE></TD>
* <TD headers="objref mirrored2"> {@link ObjectReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR>
* <TD headers="objref kind2"> an array</TD>
* <TD headers="objref example2"> <CODE>new int[5]</CODE></TD>
* <TD headers="objref mirrored2"> {@link ArrayReference}</TD>
* <TD headers="objref type2"> {@link ArrayType}</TD>
* <TR>
* <TD headers="objref kind2"> a string</TD>
* <TD headers="objref example2"> <CODE>"hello"</CODE></TD>
* <TD headers="objref mirrored2"> {@link StringReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR>
* <TD headers="objref kind2"> a thread</TD>
* <TD headers="objref example2"> <CODE>Thread.currentThread()</CODE></TD>
* <TD headers="objref mirrored2"> {@link ThreadReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR>
* <TD headers="objref kind2"> a thread group</TD>
* <TD headers="objref example2"> <CODE>Thread.currentThread()<br>&nbsp;&nbsp;.getThreadGroup()</CODE></TD>
* <TD headers="objref mirrored2"> {@link ThreadGroupReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR>
* <TD headers="objref kind2"> a <CODE>java.lang.Class</CODE><br>instance</TD>
* <TD headers="objref example2"> <CODE>this.getClass()</CODE></TD>
* <TD headers="objref mirrored2"> {@link ClassObjectReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR>
* <TD headers="objref kind2"> a class loader</TD>
* <TD headers="objref example2"> <CODE>this.getClass()<br>&nbsp;&nbsp;.getClassLoader() </CODE></TD>
* <TD headers="objref mirrored2"> {@link ClassLoaderReference}</TD>
* <TD headers="objref type2"> {@link ClassType}</TD>
* <TR BGCOLOR="#EEEEFF">
* <TH id="other" colspan=4>Other</TH>
* <TR BGCOLOR="#EEEEFF">
* <TH id="kind3" align="left">Kind of value</TD>
* <TH id="example3" align="left">For example -<br>expression in target</TD>
* <TH id="mirrored3" align="left">Is mirrored as</TD>
* <TH id="type3" align="left">{@link Type} of value</TD>
* <TR>
* <TD headers="other kind3"> null</TD>
* <TD headers="other example3"> <CODE>null</CODE></TD>
* <TD headers="other mirrored3"> <CODE>null</CODE></TD>
* <TD headers="other type3"> n/a</TD>
* </TABLE>
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface Value extends Mirror {
/**
* Returns the run-time type of this value.
*
* @see Type
* @return a {@link Type} which mirrors the value's type in the
* target VM.
*/
Type type();
}

View File

@@ -0,0 +1,864 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import com.sun.jdi.event.EventQueue;
import com.sun.jdi.request.EventRequestManager;
import java.util.List;
import java.util.Map;
/**
* A virtual machine targeted for debugging.
* More precisely, a {@link Mirror mirror} representing the
* composite state of the target VM.
* All other mirrors are associated with an instance of this
* interface. Access to all other mirrors is achieved
* directly or indirectly through an instance of this
* interface.
* Access to global VM properties and control of VM execution
* are supported directly by this interface.
* <P>
* Instances of this interface are created by instances of
* {@link com.sun.jdi.connect.Connector}. For example,
* an {@link com.sun.jdi.connect.AttachingConnector AttachingConnector}
* attaches to a target VM and returns its virtual machine mirror.
* A Connector will typically create a VirtualMachine by invoking
* the VirtualMachineManager's {@link
* com.sun.jdi.VirtualMachineManager#createVirtualMachine(Connection)}
* createVirtualMachine(Connection) method.
* <p>
* Note that a target VM launched by a launching connector is not
* guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
* received.
* <p>
* Any method on <code>VirtualMachine</code> which
* takes <code>VirtualMachine</code> as an parameter may throw
* {@link com.sun.jdi.VMDisconnectedException} if the target VM is
* disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
* available to be read from the {@link com.sun.jdi.event.EventQueue}.
* <p>
* Any method on <code>VirtualMachine</code> which
* takes <code>VirtualMachine</code> as an parameter may throw
* {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
*
* @author Robert Field
* @author Gordon Hirsch
* @author James McIlree
* @since 1.3
*/
@jdk.Exported
public interface VirtualMachine extends Mirror {
/**
* Returns the loaded reference types that
* match a given name. The name must be fully qualified
* (for example, java.lang.String). The returned list
* will contain a {@link ReferenceType} for each class
* or interface found with the given name. The search
* is confined to loaded classes only; no attempt is made
* to load a class of the given name.
* <P>
* The returned list will include reference types
* loaded at least to the point of preparation and
* types (like array) for which preparation is
* not defined.
*
* @param className the class/interface name to search for
* @return a list of {@link ReferenceType} objects, each
* mirroring a type in the target VM with the given name.
*/
List<ReferenceType> classesByName(String className);
/**
* Returns all loaded types. For each loaded type in the target
* VM a {@link ReferenceType} will be placed in the returned list.
* The list will include ReferenceTypes which mirror classes,
* interfaces, and array types.
* <P>
* The returned list will include reference types
* loaded at least to the point of preparation and
* types (like array) for which preparation is
* not defined.
*
* @return a list of {@link ReferenceType} objects, each mirroring
* a loaded type in the target VM.
*/
List<ReferenceType> allClasses();
/**
* All classes given are redefined according to the
* definitions supplied. A method in a redefined class
* is called 'equivalent' (to the old version of the
* method) if
* <UL>
* <LI>their bytecodes are the same except for indicies into
* the constant pool, and
* <LI>the referenced constants are equal.
* </UL>
* Otherwise, the new method is called 'non-equivalent'.
* If a redefined method has active stack frames, those active
* frames continue to run the bytecodes of the previous version of the
* method. If the new version of such a method is non-equivalent,
* then a method from one of these active frames is called 'obsolete' and
* {@link Method#isObsolete Method.isObsolete()}
* will return true when called on one of these methods.
* If resetting such a frame is desired, use
* {@link ThreadReference#popFrames ThreadReference.popFrames(StackFrame)}
* to pop the old obsolete method execution from the stack.
* New invocations of redefined methods will always invoke the new versions.
* <p>
* This function does not cause any initialization except
* that which would occur under the customary JVM semantics.
* In other words, redefining a class does not cause
* its initializers to be run. The values of preexisting
* static variables will remain as they were prior to the
* call. However, completely uninitialized (new) static
* variables will be assigned their default value.
* <p>
* If a redefined class has instances then all those
* instances will have the fields defined by the redefined
* class at the completion of the call. Preexisting fields
* will retain their previous values. Any new fields will
* have their default values; no instance initializers or
* constructors are run.
* <p>
* Threads need not be suspended.
* <p>
* No events are generated by this function.
* <p>
* All breakpoints in the redefined classes are deleted.
* <p>
* Not all target virtual machines support this operation.
* Use {@link #canRedefineClasses() canRedefineClasses()}
* to determine if the operation is supported.
* Use {@link #canAddMethod() canAddMethod()}
* to determine if the redefinition can add methods.
* Use {@link #canUnrestrictedlyRedefineClasses() canUnrestrictedlyRedefineClasses()}
* to determine if the redefinition can change the schema,
* delete methods, change the class hierarchy, etc.
*
* @param classToBytes A map from {@link ReferenceType}
* to array of byte.
* The bytes represent the new class definition and
* are in Java Virtual Machine class file format.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation.
* <UL>
* <LI>If {@link #canRedefineClasses() canRedefineClasses()}
* is false any call of this method will throw this exception.
* <LI>If {@link #canAddMethod() canAddMethod()} is false
* attempting to add a method will throw this exception.
* <LI>If {@link #canUnrestrictedlyRedefineClasses()
* canUnrestrictedlyRedefineClasses()}
* is false, attempting any of the following will throw
* this exception
* <UL>
* <LI>changing the schema (the fields)
* <LI>changing the hierarchy (subclasses, interfaces)
* <LI>deleting a method
* <LI>changing class modifiers
* <LI>changing method modifiers
* </UL>
* </UL>
*
* @throws java.lang.NoClassDefFoundError if the bytes
* don't correspond to the reference type (the names
* don't match).
*
* @throws java.lang.VerifyError if a "verifier" detects
* that a class, though well formed, contains an internal
* inconsistency or security problem.
*
* @throws java.lang.ClassFormatError if the bytes
* do not represent a valid class.
*
* @throws java.lang.ClassCircularityError if a
* circularity has been detected while initializing a class.
*
* @throws java.lang.UnsupportedClassVersionError if the
* major and minor version numbers in bytes
* are not supported by the VM.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @see Method#isObsolete
* @see ThreadReference#popFrames
* @see #canRedefineClasses
* @see #canAddMethod
* @see #canUnrestrictedlyRedefineClasses
*
* @since 1.4
*/
void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes);
/**
* Returns a list of the currently running threads. For each
* running thread in the target VM, a {@link ThreadReference}
* that mirrors it is placed in the list.
* The returned list contains threads created through
* java.lang.Thread, all native threads attached to
* the target VM through JNI, and system threads created
* by the target VM. Thread objects that have
* not yet been started
* (see {@link java.lang.Thread#start Thread.start()})
* and thread objects that have
* completed their execution are not included in the returned list.
*
* @return a list of {@link ThreadReference} objects, one for each
* running thread in the mirrored VM.
*/
List<ThreadReference> allThreads();
/**
* Suspends the execution of the application running in this
* virtual machine. All threads currently running will be suspended.
* <p>
* Unlike {@link java.lang.Thread#suspend Thread.suspend()},
* suspends of both the virtual machine and individual threads are
* counted. Before a thread will run again, it must be resumed
* (through {@link #resume} or {@link ThreadReference#resume})
* the same number of times it has been suspended.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void suspend();
/**
* Continues the execution of the application running in this
* virtual machine. All threads are resumed as documented in
* {@link ThreadReference#resume}.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @see #suspend
*/
void resume();
/**
* Returns each thread group which does not have a parent. For each
* top level thread group a {@link ThreadGroupReference} is placed in the
* returned list.
* <p>
* This command may be used as the first step in building a tree
* (or trees) of the existing thread groups.
*
* @return a list of {@link ThreadGroupReference} objects, one for each
* top level thread group.
*/
List<ThreadGroupReference> topLevelThreadGroups();
/**
* Returns the event queue for this virtual machine.
* A virtual machine has only one {@link EventQueue} object, this
* method will return the same instance each time it
* is invoked.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @return the {@link EventQueue} for this virtual machine.
*/
EventQueue eventQueue();
/**
* Returns the event request manager for this virtual machine.
* The {@link EventRequestManager} controls user settable events
* such as breakpoints.
* A virtual machine has only one {@link EventRequestManager} object,
* this method will return the same instance each time it
* is invoked.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*
* @return the {@link EventRequestManager} for this virtual machine.
*/
EventRequestManager eventRequestManager();
/**
* Creates a {@link BooleanValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a boolean for which to create the value
* @return the {@link BooleanValue} for the given boolean.
*/
BooleanValue mirrorOf(boolean value);
/**
* Creates a {@link ByteValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a byte for which to create the value
* @return the {@link ByteValue} for the given byte.
*/
ByteValue mirrorOf(byte value);
/**
* Creates a {@link CharValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a char for which to create the value
* @return the {@link CharValue} for the given char.
*/
CharValue mirrorOf(char value);
/**
* Creates a {@link ShortValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a short for which to create the value
* @return the {@link ShortValue} for the given short.
*/
ShortValue mirrorOf(short value);
/**
* Creates an {@link IntegerValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value an int for which to create the value
* @return the {@link IntegerValue} for the given int.
*/
IntegerValue mirrorOf(int value);
/**
* Creates a {@link LongValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a long for which to create the value
* @return the {@link LongValue} for the given long.
*/
LongValue mirrorOf(long value);
/**
* Creates a {@link FloatValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a float for which to create the value
* @return the {@link FloatValue} for the given float.
*/
FloatValue mirrorOf(float value);
/**
* Creates a {@link DoubleValue} for the given value. This value
* can be used for setting and comparing against a value retrieved
* from a variable or field in this virtual machine.
*
* @param value a double for which to create the value
* @return the {@link DoubleValue} for the given double.
*/
DoubleValue mirrorOf(double value);
/**
* Creates a string in this virtual machine.
* The created string can be used for setting and comparing against
* a string value retrieved from a variable or field in this
* virtual machine.
*
* @param value the string to be created
* @return a {@link StringReference} that mirrors the newly created
* string in the target VM.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
StringReference mirrorOf(String value);
/**
* Creates a {@link VoidValue}. This value
* can be passed to {@link ThreadReference#forceEarlyReturn}
* when a void method is to be exited.
*
* @return the {@link VoidValue}.
*/
VoidValue mirrorOfVoid();
/**
* Returns the {@link java.lang.Process} object for this
* virtual machine if launched
* by a {@link com.sun.jdi.connect.LaunchingConnector}
*
* @return the {@link java.lang.Process} object for this virtual
* machine, or null if it was not launched by a
* {@link com.sun.jdi.connect.LaunchingConnector}.
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only
* -see {@link VirtualMachine#canBeModified()}.
*/
Process process();
/**
* Invalidates this virtual machine mirror.
* The communication channel to the target VM is closed, and
* the target VM prepares to accept another subsequent connection
* from this debugger or another debugger, including the
* following tasks:
* <ul>
* <li>All event requests are cancelled.
* <li>All threads suspended by {@link #suspend} or by
* {@link ThreadReference#suspend} are resumed as many
* times as necessary for them to run.
* <li>Garbage collection is re-enabled in all cases where it was
* disabled through {@link ObjectReference#disableCollection}.
* </ul>
* Any current method invocations executing in the target VM
* are continued after the disconnection. Upon completion of any such
* method invocation, the invoking thread continues from the
* location where it was originally stopped.
* <p>
* Resources originating in
* this VirtualMachine (ObjectReferences, ReferenceTypes, etc.)
* will become invalid.
*/
void dispose();
/**
* Causes the mirrored VM to terminate with the given error code.
* All resources associated with this VirtualMachine are freed.
* If the mirrored VM is remote, the communication channel
* to it will be closed. Resources originating in
* this VirtualMachine (ObjectReferences, ReferenceTypes, etc.)
* will become invalid.
* <p>
* Threads running in the mirrored VM are abruptly terminated.
* A thread death exception is not thrown and
* finally blocks are not run.
*
* @param exitCode the exit code for the target VM. On some platforms,
* the exit code might be truncated, for example, to the lower order 8 bits.
*
* @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
*/
void exit(int exitCode);
/**
* Determines if the target VM supports watchpoints
* for field modification.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canWatchFieldModification();
/**
* Determines if the target VM supports watchpoints
* for field access.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canWatchFieldAccess();
/**
* Determines if the target VM supports the retrieval
* of a method's bytecodes.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canGetBytecodes();
/**
* Determines if the target VM supports the query
* of the synthetic attribute of a method or field.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canGetSyntheticAttribute();
/**
* Determines if the target VM supports the retrieval
* of the monitors owned by a thread.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canGetOwnedMonitorInfo();
/**
* Determines if the target VM supports the retrieval
* of the monitor for which a thread is currently waiting.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canGetCurrentContendedMonitor();
/**
* Determines if the target VM supports the retrieval
* of the monitor information for an object.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canGetMonitorInfo();
/**
* Determines if the target VM supports filtering
* events by specific instance object. For example,
* see {@link com.sun.jdi.request.BreakpointRequest#addInstanceFilter}.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*/
boolean canUseInstanceFilters();
/**
* Determines if the target VM supports any level
* of class redefinition.
* @see #redefineClasses
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canRedefineClasses();
/**
* Determines if the target VM supports the addition
* of methods when performing class redefinition.
* @see #redefineClasses
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canAddMethod();
/**
* Determines if the target VM supports unrestricted
* changes when performing class redefinition.
* @see #redefineClasses
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canUnrestrictedlyRedefineClasses();
/**
* Determines if the target VM supports popping
* frames of a threads stack.
* @see ThreadReference#popFrames
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canPopFrames();
/**
* Determines if the target VM supports getting
* the source debug extension.
* @see ReferenceType#sourceDebugExtension
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canGetSourceDebugExtension();
/**
* Determines if the target VM supports the creation of
* {@link com.sun.jdi.request.VMDeathRequest}s.
* @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.4
*/
boolean canRequestVMDeathEvent();
/**
* Determines if the target VM supports the inclusion of return values
* in
* {@link com.sun.jdi.event.MethodExitEvent}s.
* @see com.sun.jdi.request.EventRequestManager#createMethodExitRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canGetMethodReturnValues();
/**
* Determines if the target VM supports the accessing of class instances,
* instance counts, and referring objects.
*
* @see #instanceCounts
* @see ReferenceType#instances(long)
* @see ObjectReference#referringObjects(long)
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canGetInstanceInfo();
/**
* Determines if the target VM supports the filtering of
* class prepare events by source name.
*
* see {@link com.sun.jdi.request.ClassPrepareRequest#addSourceNameFilter}.
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canUseSourceNameFilters();
/**
* Determines if the target VM supports the forcing of a method to
* return early.
*
* @see ThreadReference#forceEarlyReturn(Value)
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canForceEarlyReturn();
/**
* Determines if the target VM is a read-only VM. If a method which
* would modify the state of the VM is called on a read-only VM,
* then {@link VMCannotBeModifiedException} is thrown.
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.5
*/
boolean canBeModified();
/**
* Determines if the target VM supports the creation of
* {@link com.sun.jdi.request.MonitorContendedEnterRequest}s.
* {@link com.sun.jdi.request.MonitorContendedEnteredRequest}s.
* {@link com.sun.jdi.request.MonitorWaitRequest}s.
* {@link com.sun.jdi.request.MonitorWaitedRequest}s.
* @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnterRequest
* @see com.sun.jdi.request.EventRequestManager#createMonitorContendedEnteredRequest
* @see com.sun.jdi.request.EventRequestManager#createMonitorWaitRequest
* @see com.sun.jdi.request.EventRequestManager#createMonitorWaitedRequest
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canRequestMonitorEvents();
/**
* Determines if the target VM supports getting which
* frame has acquired a monitor.
* @see com.sun.jdi.ThreadReference#ownedMonitorsAndFrames
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canGetMonitorFrameInfo();
/**
* Determines if the target VM supports reading class file
* major and minor versions.
*
* @see ReferenceType#majorVersion()
* @see ReferenceType#minorVersion()
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canGetClassFileVersion();
/**
* Determines if the target VM supports getting constant pool
* information of a class.
*
* @see ReferenceType#constantPoolCount()
* @see ReferenceType#constantPool()
*
* @return <code>true</code> if the feature is supported,
* <code>false</code> otherwise.
*
* @since 1.6
*/
boolean canGetConstantPool();
/**
* Set this VM's default stratum (see {@link Location} for a
* discussion of strata). Overrides the per-class default set
* in the class file.
* <P>
* Affects location queries (such as,
* {@link Location#sourceName()})
* and the line boundaries used in
* single stepping.
*
* @param stratum the stratum to set as VM default,
* or null to use per-class defaults.
*
* @throws java.lang.UnsupportedOperationException if the
* target virtual machine does not support this operation.
*
* @since 1.4
*/
void setDefaultStratum(String stratum);
/**
* Return this VM's default stratum.
*
* @see #setDefaultStratum(String)
* @see ReferenceType#defaultStratum()
* @return <code>null</code> (meaning that the per-class
* default - {@link ReferenceType#defaultStratum()} -
* should be used) unless the default stratum has been
* set with
* {@link #setDefaultStratum(String)}.
*
* @since 1.4
*/
String getDefaultStratum();
/**
* Returns the number of instances of each ReferenceType in the 'refTypes'
* list.
* Only instances that are reachable for the purposes of garbage collection
* are counted.
* <p>
* Not all target virtual machines support this operation.
* Use {@link VirtualMachine#canGetInstanceInfo()}
* to determine if the operation is supported.
*
* @see ReferenceType#instances(long)
* @see ObjectReference#referringObjects(long)
* @param refTypes the list of {@link ReferenceType} objects for which counts
* are to be obtained.
*
* @return an array of <code>long</code> containing one element for each
* element in the 'refTypes' list. Element i of the array contains
* the number of instances in the target VM of the ReferenceType at
* position i in the 'refTypes' list.
* If the 'refTypes' list is empty, a zero-length array is returned.
* If a ReferenceType in refTypes has been garbage collected, zero
* is returned for its instance count.
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetInstanceInfo() canGetInstanceInfo()}
* @throws NullPointerException if the 'refTypes' list is null.
* @since 1.6
*/
long[] instanceCounts(List<? extends ReferenceType> refTypes);
/**
* Returns text information on the target VM and the
* debugger support that mirrors it. No specific format
* for this information is guaranteed.
* Typically, this string contains version information for the
* target VM and debugger interfaces.
* More precise information
* on VM and JDI versions is available through
* {@link #version}, {@link VirtualMachineManager#majorInterfaceVersion},
* and {@link VirtualMachineManager#minorInterfaceVersion}
*
* @return the description.
*/
String description();
/**
* Returns the version of the Java Runtime Environment in the target
* VM as reported by the property <code>java.version</code>.
* For obtaining the JDI interface version, use
* {@link VirtualMachineManager#majorInterfaceVersion}
* and {@link VirtualMachineManager#minorInterfaceVersion}
*
* @return the target VM version.
*/
String version();
/**
* Returns the name of the target VM as reported by the
* property <code>java.vm.name</code>.
*
* @return the target VM name.
*/
String name();
/** All tracing is disabled. */
int TRACE_NONE = 0x00000000;
/** Tracing enabled for JDWP packets sent to target VM. */
int TRACE_SENDS = 0x00000001;
/** Tracing enabled for JDWP packets received from target VM. */
int TRACE_RECEIVES = 0x00000002;
/** Tracing enabled for internal event handling. */
int TRACE_EVENTS = 0x00000004;
/** Tracing enabled for internal managment of reference types. */
int TRACE_REFTYPES = 0x00000008;
/** Tracing enabled for internal management of object references. */
int TRACE_OBJREFS = 0x00000010;
/** All tracing is enabled. */
int TRACE_ALL = 0x00ffffff;
/**
* Traces the activities performed by the com.sun.jdi implementation.
* All trace information is output to System.err. The given trace
* flags are used to limit the output to only the information
* desired. The given flags are in effect and the corresponding
* trace will continue until the next call to
* this method.
* <p>
* Output is implementation dependent and trace mode may be ignored.
*
* @param traceFlags identifies which kinds of tracing to enable.
*/
void setDebugTraceMode(int traceFlags);
}

View File

@@ -0,0 +1,431 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
import com.sun.jdi.connect.*;
import com.sun.jdi.connect.spi.Connection;
import java.util.List;
import java.io.IOException;
/**
* A manager of connections to target virtual machines. The
* VirtualMachineManager allows one application to debug
* multiple target VMs. (Note that the converse is not
* supported; a target VM can be debugged by only one
* debugger application.) This interface
* contains methods to manage connections
* to remote target VMs and to obtain the {@link VirtualMachine}
* mirror for available target VMs.
* <p>
* Connections can be made using one of several different
* {@link com.sun.jdi.connect.Connector} objects. Each connector encapsulates
* a different way of connecting the debugger with a target VM.
* <p>
* The VirtualMachineManager supports many different scenarios for
* connecting a debugger to a virtual machine. Four examples
* are presented in the table below. The
* examples use the command line syntax in Sun's implementation.
* Some {@link com.sun.jdi.connect.Connector} implementations may require slightly
* different handling than presented below.
* <p>
* <TABLE BORDER WIDTH="75%" SUMMARY="Four scenarios for connecting a debugger
* to a virtual machine">
* <TR>
* <TH scope=col>Scenario</TH>
* <TH scope=col>Description</TH>
* <TR>
* <TD>Debugger launches target VM (simplest, most-common scenario)</TD>
*
* <TD>Debugger calls the
* {@link com.sun.jdi.connect.LaunchingConnector#launch(java.util.Map)}
* method of the default connector, obtained with {@link #defaultConnector}. The
* target VM is launched, and a connection between that VM and the
* debugger is established. A {@link VirtualMachine} mirror is returned.
* <P>Or, for more control
* <UL>
* <LI>
* Debugger selects a connector from the list returned by
* {@link #launchingConnectors} with desired characteristics
* (for example, transport type, etc.).
* <LI>
* Debugger calls the
* {@link com.sun.jdi.connect.LaunchingConnector#launch(java.util.Map)}
* method of the selected connector. The
* target VM is launched, and a connection between that VM and the
* debugger is established. A {@link VirtualMachine} mirror is returned.
* </UL>
* </TD>
* </TR>
* <TR>
* <TD>Debugger attaches to previously-running VM</TD>
* <TD>
* <UL>
* <LI>
* Target VM is launched using the options
* <code>-agentlib:jdwp=transport=xxx,server=y</code>
* </LI>
* <LI>
* Target VM generates and outputs the tranport-specific address at which it will
* listen for a connection.</LI>
* <LI>
* Debugger is launched. Debugger selects a connector in the list
* returned by {@link #attachingConnectors} matching the transport with
* the name "xxx".
* <LI>
* Debugger presents the default connector parameters (obtained through
* {@link com.sun.jdi.connect.Connector#defaultArguments()}) to the end user,
* allowing the user to
* fill in the transport-specific address generated by the target VM.
* <LI>
* Debugger calls the {@link com.sun.jdi.connect.AttachingConnector#attach(java.util.Map)} method
* of the selected to attach to the target VM. A {@link VirtualMachine}
* mirror is returned.
* </UL>
* </TD>
* </TR>
*
* <TR>
* <TD>Target VM attaches to previously-running debugger</TD>
* <TD>
* <LI>
* At startup, debugger selects one or more connectors from
* the list returned by {@link #listeningConnectors} for one or more
* transports.</LI>
* <LI>
* Debugger calls the {@link com.sun.jdi.connect.ListeningConnector#startListening(java.util.Map)} method for each selected
* connector. For each call, a transport-specific address string is
* generated and returned. The debugger makes the transport names and
* corresponding address strings available to the end user.
* <LI>
* Debugger calls
* {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)}
* for each selected connector to wait for
* a target VM to connect.</LI>
* <LI>
* Later, target VM is launched by end user with the options
* <code>-agentlib:jdwp=transport=xxx,address=yyy</code>
* where "xxx" the transport for one of the connectors selected by the
* the debugger and "yyy"
* is the address generated by
* {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)} for that
* transport.</LI>
* <LI>
* Debugger's call to {@link com.sun.jdi.connect.ListeningConnector#accept(java.util.Map)} returns
* a {@link VirtualMachine} mirror.</LI>
* </TD>
* </TR>
*
* <TR>
* <TD>Target VM launches debugger (sometimes called "Just-In-Time" debugging)</TD>
* <TD>
* <LI>
* Target VM is launched with the options
* <code>-agentlib:jdwp=launch=cmdline,onuncaught=y,transport=xxx,server=y</code>
* </LI>
* <LI>
* Later, an uncaught exception is thrown in the target VM. The target
* VM generates the tranport-specific address at which it will
* listen for a connection.
* <LI>Target VM launches the debugger with the following items concatenated
* together (separated by spaces) to form the command line:
* <UL>
* <LI> The launch= value
* <LI> The transport= value
* <LI> The generated transport-specific address at which VM is listening for
* debugger connection.
* </UL>
* <LI>
* Upon launch, debugger selects a connector in the list
* returned by {@link #attachingConnectors} matching the transport with
* the name "xxx".
* <LI>
* Debugger changes the default connector parameters (obtained through
* {@link com.sun.jdi.connect.Connector#defaultArguments()}) to specify
* the transport specific address at which the VM is listenig. Optionally,
* other connector arguments can be presented to the user.
* <LI>
* Debugger calls the
* {@link com.sun.jdi.connect.AttachingConnector#attach(java.util.Map)} method
* of the selected to attach to the target VM. A {@link VirtualMachine}
* mirror is returned.
* </TD>
* </TR>
* </TABLE>
*
* <p> Connectors are created at start-up time. That is, they
* are created the first time that {@link
* com.sun.jdi.Bootstrap#virtualMachineManager()} is invoked.
* The list of all Connectors created at start-up time can be
* obtained from the VirtualMachineManager by invoking the
* {@link #allConnectors allConnectors} method.
*
* <p> Connectors are created at start-up time if they are
* installed on the platform. In addition, Connectors are created
* automatically by the VirtualMachineManager to encapsulate any
* {@link com.sun.jdi.connect.spi.TransportService} implementations
* that are installed on the platform. These two mechanisms for
* creating Connectors are described here.
*
* <p> A Connector is installed on the platform if it is installed
* in a jar file that is visible to the defining class loader of
* the {@link com.sun.jdi.connect.Connector} type,
* and that jar file contains a provider configuration file named
* <tt>com.sun.jdi.connect.Connector</tt> in the resource directory
* <tt>META-INF/services</tt>, and the provider configuration file
* lists the full-qualified class name of the Connector
* implementation. A Connector is a class that implements the
* {@link com.sun.jdi.connect.Connector Connector} interface. More
* appropriately the class implements one of the specific Connector
* types, namely {@link com.sun.jdi.connect.AttachingConnector
* AttachingConnector}, {@link com.sun.jdi.connect.ListeningConnector
* ListeningConnector}, or {@link com.sun.jdi.connect.LaunchingConnector
* LaunchingConnector}. The format of the provider configuration file
* is one fully-qualified class name per line. Space and tab characters
* surrounding each class, as well as blank lines are ignored. The
* comment character is <tt>'#'</tt> (<tt>0x23</tt>), and on each
* line all characters following the first comment character are
* ignored. The file must be encoded in UTF-8.
*
* <p> At start-up time the VirtualMachineManager attempts to load
* and instantiate (using the no-arg constructor) each class listed
* in the provider configuration file. Exceptions thrown when loading
* or creating the Connector are caught and ignored. In other words,
* the start-up process continues despite of errors.
*
* <p> In addition to Connectors installed on the platform the
* VirtualMachineManager will also create Connectors to encapsulate
* any {@link com.sun.jdi.connect.spi.TransportService} implementations
* that are installed on the platform. A TransportService is
* installed on the platform if it installed in a jar file that is
* visible to the defining class loader for the
* {@link com.sun.jdi.connect.spi.TransportService} type, and that jar
* file contains a provider configuration file named
* <tt>com.sun.jdi.connect.spi.TransportService</tt> in the resource
* directory <tt>META-INF/services</tt>, and the provider
* configuration file lists the the full-qualified class name of the
* TransportService implementation. A TransportService is a concrete
* sub-class of {@link com.sun.jdi.connect.spi.TransportService
* TransportService}. The format of the provider configuration file
* is the same as the provider configuration file for Connectors
* except that each class listed must be the fully-qualified class
* name of a class that implements the TransportService interface.
*
* <p> For each TransportService installed on the platform, the
* VirtualMachineManager creates a corresponding
* {@link com.sun.jdi.connect.AttachingConnector} and
* {@link com.sun.jdi.connect.ListeningConnector}. These
* Connectors are created to encapsulate a {@link
* com.sun.jdi.connect.Transport Transport} that in turn
* encapsulates the TransportService.
* The AttachingConnector will be named based on the name of the
* transport service concatenated with the string <tt>Attach</tt>.
* For example, if the transport service {@link
* com.sun.jdi.connect.spi.TransportService#name() name()} method
* returns <tt>telepathic</tt> then the AttachingConnector will
* be named <tt>telepathicAttach</tt>. Similiarly the ListeningConnector
* will be named with the string <tt>Listen</tt> tagged onto the
* name of the transport service. The {@link
* com.sun.jdi.connect.Connector#description() description()} method
* of both the AttachingConnector, and the ListeningConnector, will
* delegate to the {@link com.sun.jdi.connect.spi.TransportService#description()
* description()} method of the underlying transport service. Both
* the AttachingConnector and the ListeningConnector will have two
* Connector {@link com.sun.jdi.connect.Connector$Argument Arguments}.
* A {@link com.sun.jdi.connect.Connector$StringArgument StringArgument}
* named <tt>address</tt> is the connector argument to specify the
* address to attach too, or to listen on. A
* {@link com.sun.jdi.connect.Connector$IntegerArgument IntegerArgument}
* named <tt>timeout</tt> is the connector argument to specify the
* timeout when attaching, or accepting. The timeout connector may be
* ignored depending on if the transport service supports an attach
* timeout or accept timeout.
*
* <p> Initialization of the virtual machine manager will fail, that is
* {@link com.sun.jdi.Bootstrap#virtualMachineManager()} will throw an
* error if the virtual machine manager is unable to create any
* connectors.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface VirtualMachineManager {
/**
* Identifies the default connector. This connector should
* be used as the launching connector when selection of a
* connector with specific characteristics is unnecessary.
*
* @return the default {@link com.sun.jdi.connect.LaunchingConnector}
*/
LaunchingConnector defaultConnector();
/**
* Returns the list of known {@link com.sun.jdi.connect.LaunchingConnector} objects.
* Any of the returned objects can be used to launch a new target
* VM and immediately create a {@link VirtualMachine} mirror for it.
*
* Note that a target VM launched by a launching connector is not
* guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
* received.
* @return a list of {@link com.sun.jdi.connect.LaunchingConnector} objects.
*/
List<LaunchingConnector> launchingConnectors();
/**
* Returns the list of known {@link com.sun.jdi.connect.AttachingConnector} objects.
* Any of the returned objects can be used to attach to an existing target
* VM and create a {@link VirtualMachine} mirror for it.
*
* @return a list of {@link com.sun.jdi.connect.AttachingConnector} objects.
*/
List<AttachingConnector> attachingConnectors();
/**
* Returns the list of known {@link com.sun.jdi.connect.ListeningConnector} objects.
* Any of the returned objects can be used to listen for a
* connection initiated by a target VM
* and create a {@link VirtualMachine} mirror for it.
*
* @return a list of {@link com.sun.jdi.connect.ListeningConnector} objects.
*/
List<ListeningConnector> listeningConnectors();
/**
* Returns the list of all known {@link com.sun.jdi.connect.Connector} objects.
*
* @return a list of {@link com.sun.jdi.connect.Connector} objects.
*/
List<Connector> allConnectors();
/**
* Lists all target VMs which are connected to the debugger.
* The list includes {@link VirtualMachine} instances for
* any target VMs which initiated a connection
* and any
* target VMs to which this manager has initiated a connection.
* A target VM will remain in this list
* until the VM is disconnected.
* {@link com.sun.jdi.event.VMDisconnectEvent} is placed in the event queue
* after the VM is removed from the list.
*
* @return a list of {@link VirtualMachine} objects, each mirroring
* a target VM.
*/
List<VirtualMachine> connectedVirtualMachines();
/**
* Returns the major version number of the JDI interface.
* See {@link VirtualMachine#version} target VM version and
* information and
* {@link VirtualMachine#description} more version information.
*
* @return the integer major version number.
*/
int majorInterfaceVersion();
/**
* Returns the minor version number of the JDI interface.
* See {@link VirtualMachine#version} target VM version and
* information and
* {@link VirtualMachine#description} more version information.
*
* @return the integer minor version number
*/
int minorInterfaceVersion();
/**
* Create a virtual machine mirror for a target VM.
*
* <p> Creates a virtual machine mirror for a target VM
* for which a {@link com.sun.jdi.connect.spi.Connection Connection}
* already exists. A Connection is created when a {@link
* com.sun.jdi.connect.Connector Connector} establishes
* a connection and successfully handshakes with a target VM.
* A Connector can then use this method to create a virtual machine
* mirror to represent the composite state of the target VM.
*
* <p> The <tt>process</tt> argument specifies the
* {@link java.lang.Process} object for the taget VM. It may be
* specified as <tt>null</tt>. If the target VM is launched
* by a {@link com.sun.jdi.connect.LaunchingConnector
* LaunchingConnector} the <tt>process</tt> argument should be
* specified, otherwise calling {@link com.sun.jdi.VirtualMachine#process()}
* on the created virtual machine will return <tt>null</tt>.
*
* <p> This method exists so that Connectors may create
* a virtual machine mirror when a connection is established
* to a target VM. Only developers creating new Connector
* implementations should need to make direct use of this
* method. </p>
*
* @param connection
* The open connection to the target VM.
*
* @param process
* If launched, the {@link java.lang.Process} object for
* the target VM. <tt>null</tt> if not launched.
*
* @return new virtual machine representing the target VM.
*
* @throws IOException
* if an I/O error occurs
*
* @throws IllegalStateException
* if the connection is not open
*
* @see com.sun.jdi.connect.spi.Connection#isOpen()
* @see com.sun.jdi.VirtualMachine#process()
*
* @since 1.5
*/
VirtualMachine createVirtualMachine(Connection connection, Process process) throws IOException;
/**
* Creates a new virtual machine.
*
* <p> This convenience method works as if by invoking {@link
* #createVirtualMachine(Connection, Process)} method and
* specifying <tt>null</tt> as the <tt>process</tt> argument.
*
* <p> This method exists so that Connectors may create
* a virtual machine mirror when a connection is established
* to a target VM. Only developers creating new Connector
* implementations should need to make direct use of this
* method. </p>
*
* @return the new virtual machine
*
* @throws IOException
* if an I/O error occurs
*
* @throws IllegalStateException
* if the connection is not open
*
* @since 1.5
*/
VirtualMachine createVirtualMachine(Connection connection) throws IOException;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* The type of all primitive <code>void</code> values
* accessed in the target VM. Calls to {@link Value#type} will return an
* implementor of this interface.
*
* @see VoidValue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface VoidType extends Type {
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi;
/**
* Provides access to a primitive <code>void</code> value in
* the target VM.
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface VoidValue extends Value {
/**
* Compares the specified Object with this VoidValue for equality.
*
* @return true if the Object is a VoidValue; false
* otherwise.
*/
boolean equals(Object obj);
/**
* Returns the hash code value for this VoidValue.
*
* @return the hash code
*/
int hashCode();
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import com.sun.jdi.VirtualMachine;
import java.util.Map;
import java.io.IOException;
/**
* A connector which attaches to a previously running target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface AttachingConnector extends Connector {
/**
* Attaches to a running application and and returns a
* mirror of its VM.
* <p>
* The connector uses the given argument map in
* attaching the application. These arguments will include addressing
* information that identifies the VM.
* The argument map associates argument name strings to instances
* of {@link Connector.Argument}. The default argument map for a
* connector can be obtained through {@link Connector#defaultArguments}.
* Argument map values can be changed, but map entries should not be
* added or deleted.
*
* @param arguments the argument map to be used in launching the VM.
* @return the {@link VirtualMachine} mirror of the target VM.
*
* @throws TransportTimeoutException when the Connector encapsulates
* a transport that supports a timeout when attaching, a
* {@link Connector.Argument} representing a timeout has been set
* in the argument map, and a timeout occurs when trying to attach
* to the target VM.
*
* @throws java.io.IOException when unable to attach.
* Specific exceptions are dependent on the Connector implementation
* in use.
* @throws IllegalConnectorArgumentsException when one of the
* connector arguments is invalid.
*/
VirtualMachine attach(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
}

View File

@@ -0,0 +1,291 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import java.util.Map;
import java.util.List;
import java.io.Serializable;
/**
* A method of connection between a debugger and a target VM.
* A connector encapsulates exactly one {@link Transport}. used
* to establish the connection. Each connector has a set of arguments
* which controls its operation. The arguments are stored as a
* map, keyed by a string. Each implementation defines the string
* argument keys it accepts.
*
* @see LaunchingConnector
* @see AttachingConnector
* @see ListeningConnector
* @see Connector.Argument
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface Connector {
/**
* Returns a short identifier for the connector. Connector implementors
* should follow similar naming conventions as are used with packages
* to avoid name collisions. For example, the Sun connector
* implementations have names prefixed with "com.sun.jdi.".
* Not intended for exposure to end-user.
*
* @return the name of this connector.
*/
String name();
/**
* Returns a human-readable description of this connector
* and its purpose.
*
* @return the description of this connector
*/
String description();
/**
* Returns the transport mechanism used by this connector to establish
* connections with a target VM.
*
* @return the {@link Transport} used by this connector.
*/
Transport transport();
/**
* Returns the arguments accepted by this Connector and their
* default values. The keys of the returned map are string argument
* names. The values are {@link Connector.Argument} containing
* information about the argument and its default value.
*
* @return the map associating argument names with argument
* information and default value.
*/
Map<String,Connector.Argument> defaultArguments();
/**
* Specification for and value of a Connector argument.
* Will always implement a subinterface of Argument:
* {@link Connector.StringArgument}, {@link Connector.BooleanArgument},
* {@link Connector.IntegerArgument},
* or {@link Connector.SelectedArgument}.
*/
@jdk.Exported
public interface Argument extends Serializable {
/**
* Returns a short, unique identifier for the argument.
* Not intended for exposure to end-user.
*
* @return the name of this argument.
*/
String name();
/**
* Returns a short human-readable label for this argument.
*
* @return a label for this argument
*/
String label();
/**
* Returns a human-readable description of this argument
* and its purpose.
*
* @return the description of this argument
*/
String description();
/**
* Returns the current value of the argument. Initially, the
* default value is returned. If the value is currently unspecified,
* null is returned.
*
* @return the current value of the argument.
*/
String value();
/**
* Sets the value of the argument.
* The value should be checked with {@link #isValid(String)}
* before setting it; invalid values will throw an exception
* when the connection is established - for example,
* on {@link LaunchingConnector#launch}
*/
void setValue(String value);
/**
* Performs basic sanity check of argument.
* @return <code>true</code> if the value is valid to be
* used in {@link #setValue(String)}
*/
boolean isValid(String value);
/**
* Indicates whether the argument must be specified. If true,
* {@link #setValue} must be used to set a non-null value before
* using this argument in establishing a connection.
*
* @return <code>true</code> if the argument must be specified;
* <code>false</code> otherwise.
*/
boolean mustSpecify();
}
/**
* Specification for and value of a Connector argument,
* whose value is Boolean. Boolean values are represented
* by the localized versions of the strings "true" and "false".
*/
@jdk.Exported
public interface BooleanArgument extends Argument {
/**
* Sets the value of the argument.
*/
void setValue(boolean value);
/**
* Performs basic sanity check of argument.
* @return <code>true</code> if value is a string
* representation of a boolean value.
* @see #stringValueOf(boolean)
*/
boolean isValid(String value);
/**
* Return the string representation of the <code>value</code>
* parameter.
* Does not set or examine the current value of <code>this</code>
* instance.
* @return the localized String representation of the
* boolean value.
*/
String stringValueOf(boolean value);
/**
* Return the value of the argument as a boolean. Since
* the argument may not have been set or may have an invalid
* value {@link #isValid(String)} should be called on
* {@link #value()} to check its validity. If it is invalid
* the boolean returned by this method is undefined.
* @return the value of the argument as a boolean.
*/
boolean booleanValue();
}
/**
* Specification for and value of a Connector argument,
* whose value is an integer. Integer values are represented
* by their corresponding strings.
*/
@jdk.Exported
public interface IntegerArgument extends Argument {
/**
* Sets the value of the argument.
* The value should be checked with {@link #isValid(int)}
* before setting it; invalid values will throw an exception
* when the connection is established - for example,
* on {@link LaunchingConnector#launch}
*/
void setValue(int value);
/**
* Performs basic sanity check of argument.
* @return <code>true</code> if value represents an int that is
* <code>{@link #min()} &lt;= value &lt;= {@link #max()}</code>
*/
boolean isValid(String value);
/**
* Performs basic sanity check of argument.
* @return <code>true</code> if
* <code>{@link #min()} &lt;= value &lt;= {@link #max()}</code>
*/
boolean isValid(int value);
/**
* Return the string representation of the <code>value</code>
* parameter.
* Does not set or examine the current value of <code>this</code>
* instance.
* @return the String representation of the
* int value.
*/
String stringValueOf(int value);
/**
* Return the value of the argument as a int. Since
* the argument may not have been set or may have an invalid
* value {@link #isValid(String)} should be called on
* {@link #value()} to check its validity. If it is invalid
* the int returned by this method is undefined.
* @return the value of the argument as a int.
*/
int intValue();
/**
* The upper bound for the value.
* @return the maximum allowed value for this argument.
*/
int max();
/**
* The lower bound for the value.
* @return the minimum allowed value for this argument.
*/
int min();
}
/**
* Specification for and value of a Connector argument,
* whose value is a String.
*/
@jdk.Exported
public interface StringArgument extends Argument {
/**
* Performs basic sanity check of argument.
* @return <code>true</code> always
*/
boolean isValid(String value);
}
/**
* Specification for and value of a Connector argument,
* whose value is a String selected from a list of choices.
*/
@jdk.Exported
public interface SelectedArgument extends Argument {
/**
* Return the possible values for the argument
* @return {@link List} of {@link String}
*/
List<String> choices();
/**
* Performs basic sanity check of argument.
* @return <code>true</code> if value is one of {@link #choices()}.
*/
boolean isValid(String value);
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
/**
* Thrown to indicate an invalid argument or
* inconsistent passed to a {@link Connector}.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class IllegalConnectorArgumentsException extends Exception {
private static final long serialVersionUID = -3042212603611350941L;
List<String> names;
/**
* Construct an <code>IllegalConnectorArgumentsException</code>
* with the specified detail message and the name of the argument
* which is invalid or inconsistent.
* @param s the detailed message.
* @param name the name of the invalid or inconsistent argument.
*/
public IllegalConnectorArgumentsException(String s,
String name) {
super(s);
names = new ArrayList<String>(1);
names.add(name);
}
/**
* Construct an <code>IllegalConnectorArgumentsException</code>
* with the specified detail message and a <code>List</code> of
* names of arguments which are invalid or inconsistent.
* @param s the detailed message.
* @param names a <code>List</code> containing the names of the
* invalid or inconsistent argument.
*/
public IllegalConnectorArgumentsException(String s, List<String> names) {
super(s);
this.names = new ArrayList<String>(names);
}
/**
* Return a <code>List</code> containing the names of the
* invalid or inconsistent arguments.
* @return a <code>List</code> of argument names.
*/
public List<String> argumentNames() {
return Collections.unmodifiableList(names);
}
}

View File

@@ -0,0 +1,75 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import com.sun.jdi.VirtualMachine;
import java.util.Map;
import java.io.IOException;
/**
* A connector which can launch a target VM before connecting to it.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface LaunchingConnector extends Connector {
/**
* Launches an application and connects to its VM. Properties
* of the launch (possibly including options,
* main class, and arguments) are specified in
* <code>arguments</code>.
* The argument map associates argument name strings to instances
* of {@link Connector.Argument}. The default argument map for a
* connector can be obtained through {@link Connector#defaultArguments}.
* Argument map values can be changed, but map entries should not be
* added or deleted.
* <p>A target VM launched by a launching connector is not
* guaranteed to be stable until after the {@link com.sun.jdi.event.VMStartEvent} has been
* received.
* <p>
* <b>Important note:</b> If a target VM is launched through this
* funcctions, its output and error streams must be read as it
* executes. These streams are available through the
* {@link java.lang.Process Process} object returned by
* {@link com.sun.jdi.VirtualMachine#process}. If the streams are not periodically
* read, the target VM will stop executing when the buffers for these
* streams are filled.
*
* @param arguments the argument map to be used in launching the VM.
* @return the {@link VirtualMachine} mirror of the target VM.
* @throws java.io.IOException when unable to launch.
* Specific exceptions are dependent on the Connector implementation
* in use.
* @throws IllegalConnectorArgumentsException when one of the
* connector arguments is invalid.
* @throws VMStartException when the VM was successfully launched, but
* terminated with an error before a connection could be established.
*/
VirtualMachine launch(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException,
VMStartException;
}

View File

@@ -0,0 +1,118 @@
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import java.util.Map;
import java.io.IOException;
import com.sun.jdi.VirtualMachine;
/**
* A connector which listens for a connection initiated by a target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface ListeningConnector extends Connector {
/**
* Indicates whether this listening connector supports multiple
* connections for a single argument map. If so, a call to
* {@link #startListening} may allow
* multiple target VM to become connected.
*
* @return {@code true} if multiple connections are supported;
* {@code false} otherwise.
*/
boolean supportsMultipleConnections();
/**
* Listens for one or more connections initiated by target VMs.
* The connector uses the given argument map
* in determining the address at which to listen or else it generates
* an appropriate listen address. In either case, an address string
* is returned from this method which can be used in starting target VMs
* to identify this connector. The format of the address string
* is connector, transport, and, possibly, platform dependent.
* <p>
* The argument map associates argument name strings to instances
* of {@link Connector.Argument}. The default argument map for a
* connector can be obtained through {@link Connector#defaultArguments}.
* Argument map values can be changed, but map entries should not be
* added or deleted.
* <p>
* This method does not return a {@link VirtualMachine}, and, normally,
* returns before any target VM initiates
* a connection. The connected target is obtained through
* {@link #accept} (using the same argument map as is passed to this
* method).
* <p>
* If {@code arguments} contains addressing information and
* only one connection will be accepted, the {@link #accept accept} method
* can be called immediately without calling this method.
*
* @return the address at which the connector is listening
* for a connection.
* @throws java.io.IOException when unable to start listening.
* Specific exceptions are dependent on the Connector implementation
* in use.
* @throws IllegalConnectorArgumentsException when one of the
* connector arguments is invalid.
*/
String startListening(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
/**
* Cancels listening for connections. The given argument map should match
* the argument map given for a previous {@link #startListening} invocation.
*
* @throws java.io.IOException when unable to stop listening.
* Specific exceptions are dependent on the Connector implementation
* in use.
* @throws IllegalConnectorArgumentsException when one of the
* connector arguments is invalid.
*/
void stopListening(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
/**
* Waits for a target VM to attach to this connector.
*
* @throws TransportTimeoutException when the Connector encapsulates
* a transport that supports a timeout when accepting, a
* {@link Connector.Argument} representing a timeout has been set
* in the argument map, and a timeout occurs whilst waiting for
* the target VM to connect.
* @throws java.io.IOException when unable to accept.
* Specific exceptions are dependent on the Connector implementation
* in use.
* @throws IllegalConnectorArgumentsException when one of the
* connector arguments is invalid.
*/
VirtualMachine accept(Map<String,? extends Connector.Argument> arguments)
throws IOException, IllegalConnectorArgumentsException;
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
import com.sun.jdi.connect.spi.TransportService; // for javadoc
/**
* A method of communication between a debugger and a target VM.
*
* <p> A Transport represents the transport mechanism used by a
* {@link com.sun.jdi.connect.Connector Connector} to establish a
* connection with a target VM. It consists of a name which is obtained
* by invoking the {@link #name} method. Furthermore, a Transport
* encapsulates a {@link com.sun.jdi.connect.spi.TransportService
* TransportService} which is the underlying service used
* to establish connections and exchange Java Debug Wire Protocol
* (JDWP) packets with a target VM.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public interface Transport {
/**
* Returns a short identifier for the transport.
*
* @return the name of this transport.
*/
String name();
}

View File

@@ -0,0 +1,78 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
/**
* This exception may be thrown as a result of a timeout
* when attaching to a target VM, or waiting to accept a
* connection from a target VM.
*
* <p> When attaching to a target VM, using {@link
* AttachingConnector#attach attach} this
* exception may be thrown if the connector supports a timeout
* {@link Connector.Argument connector argument}. Similiarly,
* when waiting to accept a connection from a target VM,
* using {@link ListeningConnector#accept accept} this
* exception may be thrown if the connector supports a
* timeout connector argument when accepting.
*
* <p> In addition, for developers creating {@link
* com.sun.jdi.connect.spi.TransportService TransportService}
* implementations this exception is thrown when
* {@link com.sun.jdi.connect.spi.TransportService#attach attach}
* times out when establishing a connection to a target VM,
* or {@link com.sun.jdi.connect.spi.TransportService#accept
* accept} times out while waiting for a target VM to connect. </p>
*
* @see AttachingConnector#attach
* @see ListeningConnector#accept
* @see com.sun.jdi.connect.spi.TransportService#attach
* @see com.sun.jdi.connect.spi.TransportService#accept
*
* @since 1.5
*/
@jdk.Exported
public class TransportTimeoutException extends java.io.IOException {
private static final long serialVersionUID = 4107035242623365074L;
/**
* Constructs a <tt>TransportTimeoutException</tt> with no detail
* message.
*/
public TransportTimeoutException() {
}
/**
* Constructs a <tt>TransportTimeoutException</tt> with the
* specified detail message.
*
* @param message the detail message pertaining to this exception.
*/
public TransportTimeoutException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect;
/**
* A target VM was successfully launched, but terminated with an
* error before a connection could be established. This exception
* provides the {@link java.lang.Process} object for the launched
* target to help in diagnosing the problem.
*
* @author Gordon Hirsch
* @since 1.3
*/
@jdk.Exported
public class VMStartException extends Exception {
private static final long serialVersionUID = 6408644824640801020L;
Process process;
public VMStartException(Process process) {
super();
this.process = process;
}
public VMStartException(String message,
Process process) {
super(message);
this.process = process;
}
public Process process() {
return process;
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This package defines connections between the virtual machine
* using the JDI and the target virtual machine.
* In concert with {@link com.sun.jdi.VirtualMachineManager}
* it is the mechanism for launching, attaching, etc to
* target virtual machines.
* <p>
* Methods may be added to the interfaces in the JDI packages in future
* releases. Existing packages may be renamed if the JDI becomes a standard
* extension.
*/
@jdk.Exported
package com.sun.jdi.connect;

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect.spi;
/**
* This exception may be thrown as a result of an asynchronous
* close of a {@link Connection} while an I/O operation is
* in progress.
*
* <p> When a thread is blocked in {@link Connection#readPacket
* readPacket} waiting for packet from a target VM the
* {@link Connection} may be closed asynchronous by another
* thread invokving the {@link Connection#close close} method.
* When this arises the thread in readPacket will throw this
* exception. Similiarly when a thread is blocked in
* {@link Connection#writePacket} the Connection may be closed.
* When this occurs the thread in writePacket will throw
* this exception.
*
* @see Connection#readPacket
* @see Connection#writePacket
*
* @since 1.5
*/
@jdk.Exported
public class ClosedConnectionException extends java.io.IOException {
private static final long serialVersionUID = 3877032124297204774L;
/**
* Constructs a <tt>ClosedConnectionException</tt> with no detail
* message.
*/
public ClosedConnectionException() {
}
/**
* Constructs a <tt>ClosedConnectionException</tt> with the
* specified detail message.
*
* @param message the detail message pertaining to this exception.
*/
public ClosedConnectionException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,201 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect.spi;
import java.io.IOException;
/**
* A connection between a debugger and a target VM which it debugs.
*
* <p> A Connection represents a bi-directional communication channel
* between a debugger and a target VM. A Connection is created when
* {@link com.sun.jdi.connect.spi.TransportService TransportService}
* establishes a connection and successfully handshakes with a target
* VM. A TransportService implementation provides a reliable
* JDWP packet transportation service and consequently a Connection
* provides a reliable flow of JDWP packets between the debugger
* and the target VM. A Connection is stream oriented, that is, the
* JDWP packets written to a connection are read by the target VM
* in the order in which they were written. Similiarly packets written
* to a Connection by the target VM are read by the debugger in the
* order in which they were written.
*
* <p> A connection is either open or closed. It is open upon creation,
* and remains open until it is closed. Once closed, it remains closed,
* and any attempt to invoke an I/O operation upon it will cause a
* {@link ClosedConnectionException} to be thrown. A connection can
* be tested by invoking the {@link #isOpen isOpen} method.
*
* <p> A Connection is safe for access by multiple concurrent threads,
* although at most one thread may be reading and at most one thread may
* be writing at any given time. </p>
*
* @since 1.5
*/
@jdk.Exported
public abstract class Connection {
/**
* Reads a packet from the target VM.
*
* <p> Attempts to read a JDWP packet from the target VM.
* A read operation may block indefinitely and only returns
* when it reads all bytes of a packet, or in the case of a
* transport service that is based on a stream-oriented
* communication protocol, the end of stream is encountered.
*
* <p> Reading a packet does not do any integrity checking on
* the packet aside from a check that the length of the packet
* (as indicated by the value of the <tt>length</tt> field, the
* first four bytes of the packet) is 11 or more bytes.
* If the value of the <tt>length</tt> value is less then 11
* then an <tt>IOException</tt> is thrown.
*
* <p> Returns a byte array of a length equal to the length
* of the received packet, or a byte array of length 0 when an
* end of stream is encountered. If end of stream is encountered
* after some, but not all bytes of a packet, are read then it
* is considered an I/O error and an <tt>IOException</tt> is
* thrown. The first byte of the packet is stored in element
* <tt>0</tt> of the byte array, the second in element <tt>1</tt>,
* and so on. The bytes in the byte array are laid out as per the
* <a href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
* JDWP specification</a>. That is, all fields in the packet
* are in big endian order as per the JDWP specification.
*
* <p> This method may be invoked at any time. If another thread has
* already initiated a {@link #readPacket readPacket} on this
* connection then the invocation of this method will block until the
* first operation is complete. </p>
*
* @return the packet read from the target VM
*
* @throws ClosedConnectionException
* If the connection is closed, or another thread closes
* the connection while the readPacket is in progress.
*
* @throws java.io.IOException
* If the length of the packet (as indictaed by the first
* 4 bytes) is less than 11 bytes, or an I/O error occurs.
*
*
*/
public abstract byte[] readPacket() throws IOException;
/**
* Writes a packet to the target VM.
*
* <p> Attempts to write, or send, a JDWP packet to the target VM.
* A write operation only returns after writing the entire packet
* to the target VM. Writing the entire packet does not mean
* the entire packet has been transmitted to the target VM
* but rather that all bytes have been written to the
* transport service. A transport service based on a TCP/IP connection
* may, for example, buffer some or all of the packet before
* transmission on the network.
*
* <p> The byte array provided to this method should be laid out
* as per the <a
* href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
* JDWP specification</a>. That is, all fields in the packet
* are in big endian order. The first byte, that is element
* <tt>pkt[0]</tt>, is the first byte of the <tt>length</tt> field.
* <tt>pkt[1]</tt> is the second byte of the <tt>length</tt> field,
* and so on.
*
* <p> Writing a packet does not do any integrity checking on
* the packet aside from checking the packet length. Checking
* the packet length requires checking that the value of the
* <tt>length</tt> field (as indicated by the first four bytes
* of the packet) is 11 or greater. Consequently the length of
* the byte array provided to this method, that is
* <tt>pkt.length</tt>, must be 11 or more, and must be equal
* or greater than the value of the <tt>length</tt> field. If the
* length of the byte array is greater than the value of
* the <tt>length</tt> field then all bytes from element
* <tt>pkt[length]</tt> onwards are ignored. In other words,
* any additional bytes that follow the packet in the byte
* array are ignored and will not be transmitted to the target
* VM.
*
* <p> A write operation may block or may complete immediately.
* The exact circumstances when an operation blocks depends on
* the transport service. In the case of a TCP/IP connection to
* the target VM, the writePacket method may block if there is
* network congestion or there is insufficient space to buffer
* the packet in the underlying network system.
*
* <p> This method may be invoked at any time. If another thread has
* already initiated a write operation upon this Connection then
* a subsequent invocation of this method will block until the first
* operation is complete. </p>
*
* @param pkt
* The packet to write to the target VM.
*
* @throws ClosedConnectionException
* If the connection is closed, or another thread closes
* the connection while the write operation is in progress.
*
* @throws java.io.IOException
* If an I/O error occurs.
*
* @throws IllegalArgumentException
* If the value of the <tt>length</tt> field is invalid,
* or the byte array is of insufficient length.
*/
public abstract void writePacket(byte pkt[]) throws IOException;
/**
* Closes this connection.
*
* <p> If the connection is already closed then invoking this method
* has no effect. After a connection is closed, any further attempt
* calls to {@link #readPacket readPacket} or {@link #writePacket
* writePacket} will throw a {@link ClosedConnectionException}.
*
* <p> Any thread currently blocked in an I/O operation ({@link
* #readPacket readPacket} or {@link #writePacket writePacket})
* will throw a {@link ClosedConnectionException}).
*
* <p> This method may be invoked at any time. If some other thread has
* already invoked it, however, then another invocation will block until
* the first invocation is complete, after which it will return without
* effect. </p>
*
* @throws java.io.IOException
* If an I/O error occurs
*/
public abstract void close() throws IOException;
/**
* Tells whether or not this connection is open. </p>
*
* @return <tt>true</tt> if, and only if, this connection is open
*/
public abstract boolean isOpen();
}

View File

@@ -0,0 +1,380 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.connect.spi;
import java.io.IOException;
import com.sun.jdi.connect.TransportTimeoutException;
/**
* A transport service for connections between a debugger and
* a target VM.
*
* <p> A transport service is a concrete subclass of this class
* that has a zero-argument constructor and implements the abstract
* methods specified below. It is the underlying service
* used by a {@link com.sun.jdi.connect.Transport} for
* connections between a debugger and a target VM.
*
* <p> A transport service is used to establish a connection
* between a debugger and a target VM, and to transport Java
* Debug Wire Protocol (JDWP) packets over an underlying
* communication protocol. In essence a transport service
* implementation binds JDWP (as specified in the
* <a href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
* JDWP specification</a>) to an underlying communication
* protocol. A transport service implementation provides
* a reliable JDWP packet transportation service. JDWP
* packets are sent to and from the target VM without duplication
* or data loss. A transport service implementation may be
* based on an underlying communication protocol that is
* reliable or unreliable. If the underlying communication
* protocol is reliable then the transport service implementation
* may be relatively simple and may only need to transport JDWP
* packets as payloads of the underlying communication
* protocol. In the case of an unreliable communication
* protocol the transport service implementation may include
* additional protocol support in order to ensure that packets
* are not duplicated and that there is no data loss. The
* details of such protocols are specific to the implementation
* but may involve techniques such as the <i>positive
* acknowledgment with retransmission</i> technique used in
* protocols such as the Transmission Control Protocol (TCP)
* (see <a href="http://www.ietf.org/rfc/rfc0793.txt"> RFC 793
* </a>).
*
* <p> A transport service can be used to initiate a connection
* to a target VM. This is done by invoking the {@link #attach}
* method. Alternatively, a transport service can listen and
* accept connections initiated by a target VM. This is done
* by invoking the {@link #startListening(String)} method to
* put the transport into listen mode. Then the {@link #accept}
* method is used to accept a connection initiated by a
* target VM.
*
* @since 1.5
*/
@jdk.Exported
public abstract class TransportService {
/**
* Returns a name to identify the transport service.
*
* @return The name of the transport service
*/
public abstract String name();
/**
* Returns a description of the transport service.
*
* @return The description of the transport service
*/
public abstract String description();
/**
* The transport service capabilities.
*/
@jdk.Exported
public static abstract class Capabilities {
/**
* Tells whether or not this transport service can support
* multiple concurrent connections to a single address that
* it is listening on.
*
* @return <tt>true</tt> if, and only if, this transport
* service supports multiple connections.
*/
public abstract boolean supportsMultipleConnections();
/**
* Tell whether or not this transport service supports a timeout
* when attaching to a target VM.
*
* @return <tt>true</tt> if, and only if, this transport
* service supports attaching with a timeout.
*
* @see #attach(String,long,long)
*/
public abstract boolean supportsAttachTimeout();
/**
* Tell whether or not this transport service supports a
* timeout while waiting for a target VM to connect.
*
* @return <tt>true</tt> if, and only if, this transport
* service supports timeout while waiting for
* a target VM to connect.
*
* @see #accept(TransportService.ListenKey,long,long)
*/
public abstract boolean supportsAcceptTimeout();
/**
* Tells whether or not this transport service supports a
* timeout when handshaking with the target VM.
*
* @return <tt>true</tt> if, and only if, this transport
* service supports a timeout while handshaking
* with the target VM.
*
* @see #attach(String,long,long)
* @see #accept(TransportService.ListenKey,long,long)
*/
public abstract boolean supportsHandshakeTimeout();
}
/**
* Returns the capabilities of the transport service.
*
* @return the transport service capabilities
*/
public abstract Capabilities capabilities();
/**
* Attaches to the specified address.
*
* <p> Attaches to the specified address and returns a connection
* representing the bi-directional communication channel to the
* target VM.
*
* <p> Attaching to the target VM involves two steps:
* First, a connection is established to specified address. This
* is followed by a handshake to ensure that the connection is
* to a target VM. The handshake involves the exchange
* of a string <i>JDWP-Handshake</i> as specified in the <a
* href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
* Java Debug Wire Protocol</a> specification.
*
* @param address
* The address of the target VM.
*
* @param attachTimeout
* If this transport service supports an attach timeout,
* and if <tt>attachTimeout</tt> is positive, then it specifies
* the timeout, in milliseconds (more or less), to use
* when attaching to the target VM. If the transport service
* does not support an attach timeout, or if <tt>attachTimeout</tt>
* is specified as zero then attach without any timeout.
*
* @param handshakeTimeout
* If this transport service supports a handshake timeout,
* and if <tt>handshakeTimeout</tt> is positive, then it
* specifies the timeout, in milliseconds (more or less), to
* use when handshaking with the target VM. The exact
* usage of the timeout are specific to the transport service.
* A transport service may, for example, use the handshake
* timeout as the inter-character timeout while waiting for
* the <i>JDWP-Handshake</i> message from the target VM.
* Alternatively, a transport service may, for example,
* use the handshakeTimeout as a timeout for the duration of the
* handshake exchange.
* If the transport service does not support a handshake
* timeout, or if <tt>handshakeTimeout</tt> is specified
* as zero then the handshake does not timeout if there
* isn't a response from the target VM.
*
* @return The Connection representing the bi-directional
* communication channel to the target VM.
*
* @throws TransportTimeoutException
* If a timeout occurs while establishing the connection.
*
* @throws IOException
* If an I/O error occurs (including a timeout when
* handshaking).
*
* @throws IllegalArgumentException
* If the address is invalid or the value of the
* attach timeout or handshake timeout is negative.
*
* @see TransportService.Capabilities#supportsAttachTimeout()
*/
public abstract Connection attach(String address, long attachTimeout,
long handshakeTimeout) throws IOException;
/**
* A <i>listen key</i>.
*
* <p> A <tt>TransportService</tt> may listen on multiple, yet
* different, addresses at the same time. To uniquely identify
* each <tt>listener</tt> a listen key is created each time that
* {@link #startListening startListening} is called. The listen
* key is used in calls to the {@link #accept accept} method
* to accept inbound connections to that listener. A listen
* key is valid until it is used as an argument to {@link
* #stopListening stopListening} to stop the transport
* service from listening on an address.
*/
@jdk.Exported
public static abstract class ListenKey {
/**
* Returns a string representation of the listen key.
*/
public abstract String address();
}
/**
* Listens on the specified address for inbound connections.
*
* <p> This method starts the transport service listening on
* the specified address so that it can subsequently accept
* an inbound connection. It does not wait until an inbound
* connection is established.
*
* @param address
* The address to start listening for connections,
* or <tt>null</tt> to listen on an address chosen
* by the transport service.
*
* @return a listen key to be used in subsequent calls to be
* {@link #accept accept} or {@link #stopListening
* stopListening} methods.
*
* @throws IOException
* If an I/O error occurs.
*
* @throws IllegalArgumentException
* If the specific address is invalid
*/
public abstract ListenKey startListening(String address) throws IOException;
/**
* Listens on an address chosen by the transport service.
*
* <p> This convenience method works as if by invoking {@link
* #startListening(String) startListening(<tt>null</tt>)}. </p>
*
* @return a listen key to be used in subsequent calls to be
* {@link #accept accept} or {@link #stopListening
* stopListening} methods.
*
* @throws IOException
* If an I/O error occurs.
*/
public abstract ListenKey startListening() throws IOException;
/**
* Stop listening for inbound connections.
*
* <p> Invoking this method while another thread is blocked
* in {@link #accept accept}, with the same listen key,
* waiting to accept a connection will cause that thread to
* throw an IOException. If the thread blocked in accept
* has already accepted a connection from a target VM and
* is in the process of handshaking with the target VM then
* invoking this method will not cause the thread to throw
* an exception.
*
* @param listenKey
* The listen key obtained from a previous call to {@link
* #startListening(String)} or {@link #startListening()}.
*
* @throws IllegalArgumentException
* If the listen key is invalid
*
* @throws IOException
* If an I/O error occurs.
*/
public abstract void stopListening(ListenKey listenKey) throws IOException;
/**
* Accept a connection from a target VM.
*
* <p> Waits (indefinitely or with timeout) to accept a connection
* from a target VM. Returns a connection representing the
* bi-directional communication channel to the target VM.
*
* <p> Accepting a connection from a target VM involves two
* steps. First, the transport service waits to accept
* the connection from the target VM. Once the connection is
* established a handshake is performed to ensure that the
* connection is indeed to a target VM. The handshake involves
* the exchange of a string <i>JDWP-Handshake</i> as specified
* in the <a
* href="../../../../../../../../../technotes/guides/jpda/jdwp-spec.html">
* Java Debug Wire Protocol</a> specification.
*
* @param listenKey
* A listen key obtained from a previous call to {@link
* #startListening(String)} or {@link #startListening()}.
*
* @param acceptTimeout
* if this transport service supports an accept timeout, and
* if <tt>acceptTimeout</tt> is positive then block for up to
* <tt>acceptTimeout</tt> milliseconds, more or less, while waiting
* for the target VM to connect.
* If the transport service does not support an accept timeout
* or if <tt>acceptTimeout</tt> is zero then block indefinitely
* for a target VM to connect.
*
* @param handshakeTimeout
* If this transport service supports a handshake timeout,
* and if <tt>handshakeTimeout</tt> is positive, then it
* specifies the timeout, in milliseconds (more or less), to
* use when handshaking with the target VM. The exact
* usage of the timeout is specific to the transport service.
* A transport service may, for example, use the handshake
* timeout as the inter-character timeout while waiting for
* the <i>JDWP-Handshake</i> message from the target VM.
* Alternatively, a transport service may, for example,
* use the timeout as a timeout for the duration of the
* handshake exchange.
* If the transport service does not support a handshake
* timeout, of if <tt>handshakeTimeout</tt> is specified
* as zero then the handshake does not timeout if there
* isn't a response from the target VM.
*
* @return The Connection representing the bi-directional
* communication channel to the target VM.
*
* @throws TransportTimeoutException
* If a timeout occurs while waiting for a target VM
* to connect.
*
* @throws IOException
* If an I/O error occurs (including a timeout when
* handshaking).
*
* @throws IllegalArgumentException
* If the value of the acceptTimeout argument, or
* handshakeTimeout is negative, or an invalid listen key
* is provided.
*
* @throws IllegalStateException
* If {@link #stopListening stopListening} has already been
* called with this listen key and the transport service
* is no longer listening for inbound connections.
*
* @see TransportService.Capabilities#supportsAcceptTimeout()
*/
public abstract Connection accept(ListenKey listenKey, long acceptTimeout,
long handshakeTimeout) throws IOException;
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This package comprises the interfaces and classes used to
* develop new {@link com.sun.jdi.connect.spi.TransportService}
* implementations.
*/
@jdk.Exported
package com.sun.jdi.connect.spi;

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a field access in the target VM. Field modifications
* are not considered field accesses.
*
* @see EventQueue
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface AccessWatchpointEvent extends WatchpointEvent {
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
import java.util.List;
/**
* Notification of a breakpoint in the target VM.
* The breakpoint event
* is generated before the code at its location is executed.
* When a location
* is reached which satisfies a currently enabled
* {@link com.sun.jdi.request.BreakpointRequest breakpoint request},
* an {@link EventSet event set}
* containing an instance of this class will be added
* to the VM's event queue.
*
* @see EventQueue
* @see VirtualMachine
* @see com.sun.jdi.request.BreakpointRequest
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface BreakpointEvent extends LocatableEvent {
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a class prepare in the target VM. See the JVM
* specification for a definition of class preparation. Class prepare
* events are not generated for primtiive classes (for example,
* java.lang.Integer.TYPE).
*
* @see EventQueue
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ClassPrepareEvent extends Event {
/**
* Returns the thread in which this event has occurred.
* <p>
* In rare cases, this event may occur in a debugger system
* thread within the target VM. Debugger threads take precautions
* to prevent these events, but they cannot be avoided under some
* conditions, especially for some subclasses of
* {@link java.lang.Error}.
* If the event was generated by a debugger system thread, the
* value returned by this method is null, and if the requested
* suspend policy for the event was
* {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
* all threads will be suspended instead, and the
* {@link EventSet#suspendPolicy} will reflect this change.
* <p>
* Note that the discussion above does not apply to system threads
* created by the target VM during its normal (non-debug) operation.
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM, or null in the rare cases described above.
*/
public ThreadReference thread();
/**
* Returns the reference type for which this event was generated.
*
* @return a {@link ReferenceType} which mirrors the class, interface, or
* array which has been linked.
*/
public ReferenceType referenceType();
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a class unload in the target VM.
* <p>
* There are severe constraints on the debugger back-end during
* garbage collection, so unload information is greatly limited.
*
* @see EventQueue
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ClassUnloadEvent extends Event {
/**
* Returns the name of the class that has been unloaded.
*/
public String className();
/**
* Returns the JNI-style signature of the class that has been unloaded.
*/
public String classSignature();
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
import com.sun.jdi.request.EventRequest;
/**
* An occurrence in a target VM that is of interest to a debugger. Event is
* the common superinterface for all events (examples include
* {@link BreakpointEvent}, {@link ExceptionEvent},
* {@link ClassPrepareEvent}).
* When an event occurs, an instance of Event as a component of
* an {@link EventSet} is enqueued in the
* {@link VirtualMachine}'s {@link EventQueue}.
*
* @see EventSet
* @see EventQueue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface Event extends Mirror {
/**
* @return The {@link EventRequest} that requested this event.
* Some events (eg. {@link VMDeathEvent}) may not have
* a cooresponding request and thus will return null.
*/
EventRequest request();
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
import java.util.Iterator;
/**
* EventIterators are unmodifiable.
*
* @see Event
* @see EventSet
* @see EventSet#iterator
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface EventIterator extends Iterator<Event> {
/**
* @return The next {@link Event} in an {@link EventSet}.
*/
Event nextEvent();
}

View File

@@ -0,0 +1,89 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Manager of incoming debugger events for a target VM.
* Events are always grouped in {@link EventSet}s.
* EventSets generated by the debugger back end can be read
* here. There is one instance of EventQueue assigned to a particular
* {@link com.sun.jdi.VirtualMachine VirtualMachine}.
* <P>
* Some events cause the suspension of the target VM - event requests
* ({@link com.sun.jdi.request}) with a
* {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
* of {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
* or {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD
* SUSPEND_EVENT_THREAD} and sometimes
* {@link VMStartEvent}.
* If these suspensions are not resumed the target VM will hang.
* Thus, it is always good policy to
* {@link #remove() remove()} every EventSet from the
* event queue until an EventSet containing a
* {@link VMDisconnectEvent} is read.
* Unless {@link com.sun.jdi.VirtualMachine#resume() resume} is
* being handled in another way, each EventSet should invoke
* {@link EventSet#resume()}.
*
* @see EventSet
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface EventQueue extends Mirror {
/**
* Waits forever for the next available event.
*
* @return the next {@link EventSet}.
* @throws InterruptedException if any thread has interrupted
* this thread.
* @throws com.sun.jdi.VMDisconnectedException if the connection
* to the target VM is no longer available. Note this will always
* be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
*/
EventSet remove() throws InterruptedException;
/**
* Waits a specified time for the next available event.
*
* @param timeout Time in milliseconds to wait for the next event
* @return the next {@link EventSet}, or null if there is a timeout.
* @throws InterruptedException if any thread has interrupted
* this thread.
* @throws com.sun.jdi.VMDisconnectedException if the connection
* to the target VM is no longer available. Note this will always
* be preceded by a {@link com.sun.jdi.event.VMDisconnectEvent}.
* @throws IllegalArgumentException if the timeout argument
* contains an illegal value.
*/
EventSet remove(long timeout) throws InterruptedException;
}

View File

@@ -0,0 +1,172 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
import java.util.Set;
/**
* Several {@link Event} objects may be created at a given time by
* the target {@link VirtualMachine}. For example, there may be
* more than one {@link com.sun.jdi.request.BreakpointRequest}
* for a given {@link Location}
* or you might single step to the same location as a
* BreakpointRequest. These {@link Event} objects are delivered
* together as an EventSet. For uniformity, an EventSet is always used
* to deliver {@link Event} objects. EventSets are delivered by
* the {@link EventQueue}.
* EventSets are unmodifiable.
* <P>
* Associated with the issuance of an event set, suspensions may
* have occurred in the target VM. These suspensions correspond
* with the {@link #suspendPolicy() suspend policy}.
* To assure matching resumes occur, it is recommended,
* where possible,
* to complete the processing of an event set with
* {@link #resume() EventSet.resume()}.
* <P>
* The events that are grouped in an EventSet are restricted in the
* following ways:
* <P>
* <UL>
* <LI>Always singleton sets:
* <UL>
* <LI>{@link VMStartEvent}
* <LI>{@link VMDisconnectEvent}
* </UL>
* <LI>Only with other VMDeathEvents:
* <UL>
* <LI>{@link VMDeathEvent}
* </UL>
* <LI>Only with other ThreadStartEvents for the same thread:
* <UL>
* <LI>{@link ThreadStartEvent}
* </UL>
* <LI>Only with other ThreadDeathEvents for the same thread:
* <UL>
* <LI>{@link ThreadDeathEvent}
* </UL>
* <LI>Only with other ClassPrepareEvents for the same class:
* <UL>
* <LI>{@link ClassPrepareEvent}
* </UL>
* <LI>Only with other ClassUnloadEvents for the same class:
* <UL>
* <LI>{@link ClassUnloadEvent}
* </UL>
* <LI>Only with other AccessWatchpointEvents for the same field access:
* <UL>
* <LI>{@link AccessWatchpointEvent}
* </UL>
* <LI>Only with other ModificationWatchpointEvents for the same field
* modification:
* <UL>
* <LI>{@link ModificationWatchpointEvent}
* </UL>
* <LI>Only with other ExceptionEvents for the same exception occurrance:
* <UL>
* <LI>{@link ExceptionEvent}
* </UL>
* <LI>Only with other MethodExitEvents for the same method exit:
* <UL>
* <LI>{@link MethodExitEvent}
* </UL>
* <LI>Only with other Monitor contended enter events for the same monitor object:
* <UL>
* <LI>Monitor Contended Enter Event
* </UL>
* <LI>Only with other Monitor contended entered events for the same monitor object:
* <UL>
* <LI>Monitor Contended Entered Event
* </UL>
* <LI>Only with other Monitor wait events for the same monitor object:
* <UL>
* <LI>Monitor Wait Event
* </UL>
* <LI>Only with other Monitor waited events for the same monitor object:
* <UL>
* <LI>Monitor Waited Event
* </UL>
* <LI>Only with other members of this group, at the same location
* and in the same thread:
* <UL>
* <LI>{@link BreakpointEvent}
* <LI>{@link StepEvent}
* <LI>{@link MethodEntryEvent}
* </UL>
* </UL>
*
* @see Event
* @see EventQueue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface EventSet extends Mirror, Set<Event> {
/**
* Returns the policy used to suspend threads in the target VM
* for this event set. This policy is selected from the suspend
* policies for each event's request; the target VM chooses the
* policy which suspends the most threads. The target VM
* suspends threads according to that policy
* and that policy is returned here. See
* {@link com.sun.jdi.request.EventRequest} for the possible
* policy values.
* <p>
* In rare cases, the suspend policy may differ from the requested
* value if a {@link ClassPrepareEvent} has occurred in a
* debugger system thread. See {@link ClassPrepareEvent#thread}
* for details.
*
* @return the suspendPolicy which is either
* {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL},
* {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD SUSPEND_EVENT_THREAD} or
* {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
*/
int suspendPolicy();
/**
* Return an iterator specific to {@link Event} objects.
*/
EventIterator eventIterator();
/**
* Resumes threads suspended by this event set. If the {@link #suspendPolicy}
* is {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL}, a call
* to this method is equivalent to
* {@link com.sun.jdi.VirtualMachine#resume}. If the
* suspend policy is
* {@link com.sun.jdi.request.EventRequest#SUSPEND_EVENT_THREAD},
* a call to this method is equivalent to
* {@link com.sun.jdi.ThreadReference#resume} for the event thread.
* Otherwise, a call to this method is a no-op.
*/
void resume();
}

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of an exception in the target VM. When an exception
* is thrown which satisfies a currently enabled
* {@link com.sun.jdi.request.ExceptionRequest exception request},
* an {@link EventSet event set}
* containing an instance of this class will be added
* to the VM's event queue.
* If the exception is thrown from a non-native method,
* the exception event is generated at the location where the
* exception is thrown.
* If the exception is thrown from a native method, the exception event
* is generated at the first non-native location reached after the exception
* is thrown.
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ExceptionEvent extends LocatableEvent {
/**
* Gets the thrown exception object. The exception object is
* an instance of {@link java.lang.Throwable} or a subclass in the
* target VM.
*
* @return an {@link ObjectReference} which mirrors the thrown object in
* the target VM.
*/
public ObjectReference exception();
/**
* Gets the location where the exception will be caught. An exception
* is considered to be caught if, at the point of the throw, the
* current location is dynamically enclosed in a try statement that
* handles the exception. (See the JVM specification for details).
* If there is such a try statement, the catch location is the
* first code index of the appropriate catch clause.
* <p>
* If there are native methods in the call stack at the time of the
* exception, there are important restrictions to note about the
* returned catch location. In such cases,
* it is not possible to predict whether an exception will be handled
* by some native method on the call stack.
* Thus, it is possible that exceptions considered uncaught
* here will, in fact, be handled by a native method and not cause
* termination of the target VM. Furthermore, it cannot be assumed that the
* catch location returned here will ever be reached by the throwing
* thread. If there is
* a native frame between the current location and the catch location,
* the exception might be handled and cleared in that native method
* instead.
* <p>
* Note that the compiler can generate try-catch blocks in some cases
* where they are not explicit in the source code; for example,
* the code generated for <code>synchronized</code> and
* <code>finally</code> blocks can contain implicit try-catch blocks.
* If such an implicitly generated try-catch is
* present on the call stack at the time of the throw, the exception
* will be considered caught even though it appears to be uncaught from
* examination of the source code.
*
* @return the {@link Location} where the exception will be caught or null if
* the exception is uncaught.
*/
public Location catchLocation();
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
import java.util.List;
/**
* Abstract superinterface of events which have both location
* and thread.
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface LocatableEvent extends Event, Locatable {
/**
* Returns the thread in which this event has occurred.
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a method invocation in the target VM. This event
* occurs after entry into the invoked method and before any
* code has executed.
* Method entry events are generated for both native and non-native
* methods.
* <P>
* In some VMs method entry events can occur for a particular thread
* before its {@link ThreadStartEvent} occurs if methods are called
* as part of the thread's initialization.
*
* @see EventQueue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface MethodEntryEvent extends LocatableEvent {
/**
* Returns the method that was entered.
*
* @return a {@link Method} which mirrors the method that was entered.
*/
public Method method();
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a method return in the target VM. This event
* is generated after all code in the method has executed, but the
* location of this event is the last executed location in the method.
* Method exit events are generated for both native and non-native
* methods. Method exit events are not generated if the method terminates
* with a thrown exception.
*
* @see EventQueue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface MethodExitEvent extends LocatableEvent {
/**
* Returns the method that was exited.
*
* @return a {@link Method} which mirrors the method that was exited.
* @throws ObjectCollectedException may be thrown if class
* has been garbage collected.
*/
public Method method();
/**
* Returns the value that the method will return.
*
* Not all target virtual machines support this operation.
* Use
* {@link VirtualMachine#canGetMethodReturnValues() canGetMethodReturnValues()}
* to determine if this operation is supported.
*
* @return a {@link Value} which mirrors the value to be returned.
*
* @throws java.lang.UnsupportedOperationException if
* the target virtual machine does not support this
* operation - see
* {@link VirtualMachine#canGetMethodReturnValues() canGetMethodReturnValues()}
*
* @since 1.6
*/
public Value returnValue();
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a field modification in the
* target VM.
*
* @see EventQueue
* @see VirtualMachine
* @see com.sun.jdi.request.ModificationWatchpointRequest
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ModificationWatchpointEvent extends WatchpointEvent {
/**
* Value that will be assigned to the field when the instruction
* completes.
*/
Value valueToBe();
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
*
* Notification that a thread in the target VM is attempting
* to enter a monitor that is already acquired by another thread.
* <P>
*
* @see EventQueue
* @see MonitorContendedEnteredEvent
*
*
* @author Swamy Venkataramanappa
* @since 1.6
*/
@jdk.Exported
public interface MonitorContendedEnterEvent extends LocatableEvent {
/**
* Returns the thread in which this event has occurred.
* <p>
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
/**
* Returns the method that was entered.
*
* @return an {@link ObjectReference} for the monitor.
*/
public ObjectReference monitor();
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
*
* Notification that a thread in the target VM is entering a monitor
* after waiting for it to be released by another thread.
* <P>
*
* @see EventQueue
* @see MonitorContendedEnterEvent
*
* @author Swamy Venkataramanappa
* @since 1.6
*/
@jdk.Exported
public interface MonitorContendedEnteredEvent extends LocatableEvent {
/**
* Returns the thread in which this event has occurred.
* <p>
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
/**
* Returns the monitor that was entered.
*
* @return an {@link ObjectReference} for the monitor.
*/
public ObjectReference monitor();
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification that a thread in the target VM is about to
* wait on a monitor object.
* <P>
*
* @see EventQueue
* @see MonitorWaitedEvent
*
* @author Swamy Venkataramanappa
* @since 1.6
*/
@jdk.Exported
public interface MonitorWaitEvent extends LocatableEvent {
/**
* Returns the thread in which monitor wait event has occurred.
* <p>
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
/**
* Returns the monitor object that the thread about to wait.
*
* @return an {@link ObjectReference} for the monitor.
*/
public ObjectReference monitor();
/**
* Returns the number of millisecond the thread will wait.
*
* @return a <code>jlong</code> containing monitor wait time in milliseconds.
*/
public long timeout();
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification that a thread in the target VM has finished
* waiting on an monitor object.
* <P>
*
* @see EventQueue
* @see MonitorWaitEvent
*
* @author Swamy Venkataramanappa
* @since 1.6
*/
@jdk.Exported
public interface MonitorWaitedEvent extends LocatableEvent {
/**
* Returns the thread in which this event has occurred.
* <p>
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
/**
* Returns the monitor object this thread waited on.
*
* @return an {@link ObjectReference} for the monitor.
*/
public ObjectReference monitor();
/**
* Returns whether the wait has timed out or been interrupted.
*
* @return <code>true</code> if the wait is timed out.
*/
public boolean timedout();
}

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of step completion in the target VM.
* The step event
* is generated immediately before the code at its location is executed;
* thus, if the step is entering a new method (as might occur with
* {@link com.sun.jdi.request.StepRequest#STEP_INTO StepRequest.STEP_INTO})
* the location of the event is the first instruction of the method.
* When a step leaves a method, the location of the event will be the
* first instruction after the call in the calling method; note that
* this location may not be at a line boundary, even if
* {@link com.sun.jdi.request.StepRequest#STEP_LINE StepRequest.STEP_LINE}
* was used.
*
* @see com.sun.jdi.request.StepRequest
* @see EventQueue
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface StepEvent extends LocatableEvent {
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a completed thread in the target VM. The
* notification is generated by the dying thread before it terminates.
* Because of this timing, it is possible
* for {@link VirtualMachine#allThreads} to return this thread
* after this event is received.
* <p>
* Note that this event gives no information
* about the lifetime of the thread object. It may or may not be collected
* soon depending on what references exist in the target VM.
*
* @see EventQueue
* @see VirtualMachine
* @see ThreadReference
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ThreadDeathEvent extends Event {
/**
* Returns the thread which is terminating.
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of a new running thread in the target VM.
* The new thread can be the result of a call to
* <code>{@link java.lang.Thread#start}</code> or the result of
* attaching a new thread to the VM though JNI. The
* notification is generated by the new thread some time before
* its execution starts.
* Because of this timing, it is possible to receive other events
* for the thread before this event is received. (Notably,
* {@link MethodEntryEvent}s and {@link MethodExitEvent}s might occur
* during thread initialization.)
* It is also possible for {@link VirtualMachine#allThreads} to return
* a new started thread before this event is received.
* <p>
* Note that this event gives no information
* about the creation of the thread object which may have happened
* much earlier, depending on the VM being debugged.
*
* @see EventQueue
* @see VirtualMachine
* @see ThreadReference
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface ThreadStartEvent extends Event {
/**
* Returns the thread which has started.
*
* @return a {@link ThreadReference} which mirrors the event's thread in
* the target VM.
*/
public ThreadReference thread();
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of target VM termination.
* This event occurs if the target VM terminates before the
* VM disconnects ({@link VMDisconnectEvent}).
* Thus, this event will NOT occur if
* external forces terminate the connection (e.g. a crash)
* or if the connection is intentionally terminated with
* {@link com.sun.jdi.VirtualMachine#dispose()
* VirtualMachine.dispose()}
* <P>
* On VM termination, a single unsolicited VMDeathEvent
* will always be sent with a
* {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
* of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE SUSPEND_NONE}.
* Additional VMDeathEvents will be sent in the same event set if they are
* requested with a
* {@link com.sun.jdi.request.VMDeathRequest VMDeathRequest}.
* <P>
* The VM is still intact and can be queried at the point this
* event was initiated but immediately thereafter it is not
* considered intact and cannot be queried.
* Note: If the enclosing {@link EventSet} has a
* {@link com.sun.jdi.request.EventRequest#suspendPolicy() suspend policy}
* other than
* {@link com.sun.jdi.request.EventRequest#SUSPEND_ALL SUSPEND_ALL}
* the initiating point may be long past.
* <P>
* All VMDeathEvents will be in a single {@link EventSet},
* no other events will be in the event set. A resume
* must occur to continue execution after any event set which
* performs suspensions - in this case to allow proper shutdown.
*
* @see VMDisconnectEvent
* @see com.sun.jdi.request.EventRequestManager#createVMDeathRequest
* @see com.sun.jdi.request.VMDeathRequest
* @see EventQueue
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface VMDeathEvent extends Event {
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.jdi.event;
import com.sun.jdi.*;
/**
* Notification of disconnection from target VM.
* May be caused by normal termination of a VM,
* VM termination by uncaught exception or other error,
* debugger action (
* {@link VirtualMachine#dispose} or
* {@link VirtualMachine#exit}) or by external events
* (for example, target process termination by the
* operating system, transport termination, etc).
* <p>
* If the target VM terminates before the disconnection, this event
* will be preceded by a {@link VMDeathEvent}.
* <p>
* This event is always sent.
* There is no corresponding {@link com.sun.jdi.request.EventRequest}.
* The enclosing singleton {@link EventSet} always has a
* suspend policy of {@link com.sun.jdi.request.EventRequest#SUSPEND_NONE}.
*
* @see VMDeathEvent
* @see EventQueue
* @see VirtualMachine
*
* @author Robert Field
* @since 1.3
*/
@jdk.Exported
public interface VMDisconnectEvent extends Event {
}

Some files were not shown because too many files have changed in this diff Show More