< prev index next >

src/jdk.jdi/share/classes/com/sun/jdi/VirtualMachine.java

Print this page

  1 /*
  2  * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any

233      * @throws java.lang.ClassCircularityError if a
234      * circularity has been detected while initializing a class.
235      *
236      * @throws java.lang.UnsupportedClassVersionError if the
237      * major and minor version numbers in bytes
238      * are not supported by the VM.
239      *
240      * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
241      *
242      * @see Method#isObsolete
243      * @see ThreadReference#popFrames
244      * @see #canRedefineClasses
245      * @see #canAddMethod
246      * @see #canUnrestrictedlyRedefineClasses
247      *
248      * @since 1.4
249      */
250     void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes);
251 
252     /**
253      * Returns a list of the currently running threads. For each
254      * running thread in the target VM, a {@link ThreadReference}
255      * that mirrors it is placed in the list.
256      * The returned list contains threads created through
257      * java.lang.Thread, all native threads attached to
258      * the target VM through JNI, and system threads created
259      * by the target VM. Thread objects that have
260      * not yet been started

261      * (see {@link java.lang.Thread#start Thread.start()})
262      * and thread objects that have
263      * completed their execution are not included in the returned list.
264      *
265      * @return a list of {@link ThreadReference} objects, one for each
266      * running thread in the mirrored VM.
267      */
268     List<ThreadReference> allThreads();
269 
270     /**
271      * Suspends the execution of the application running in this
272      * virtual machine. All threads currently running will be suspended.
273      * <p>
274      * Unlike {@link java.lang.Thread#suspend Thread.suspend()},
275      * suspends of both the virtual machine and individual threads are
276      * counted. Before a thread will run again, it must be resumed
277      * (through {@link #resume} or {@link ThreadReference#resume})
278      * the same number of times it has been suspended.
279      *
280      * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
281      */
282     void suspend();
283 
284     /**
285      * Continues the execution of the application running in this
286      * virtual machine. All threads are resumed as documented in

768     boolean canGetConstantPool();
769 
770     /**
771      * Determines if the target VM supports getting information about modules.
772      *
773      * @return {@code true} if the feature is supported, {@code false} otherwise
774      *
775      * @implSpec
776      * The default implementation returns {@code false}.
777      *
778      * @see VirtualMachine#allModules()
779      * @see ReferenceType#module()
780      * @see ModuleReference
781      *
782      * @since 9
783      */
784     default boolean canGetModuleInfo() {
785         return false;
786     }
787 

















788     /**
789      * Set this VM's default stratum (see {@link Location} for a
790      * discussion of strata).  Overrides the per-class default set
791      * in the class file.
792      * <P>
793      * Affects location queries (such as,
794      * {@link Location#sourceName()})
795      * and the line boundaries used in
796      * single stepping.
797      *
798      * @param stratum the stratum to set as VM default,
799      * or null to use per-class defaults.
800      *
801      * @throws java.lang.UnsupportedOperationException if the
802      * target virtual machine does not support this operation.
803      *
804      * @since 1.4
805      */
806     void setDefaultStratum(String stratum);
807 

  1 /*
  2  * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any

233      * @throws java.lang.ClassCircularityError if a
234      * circularity has been detected while initializing a class.
235      *
236      * @throws java.lang.UnsupportedClassVersionError if the
237      * major and minor version numbers in bytes
238      * are not supported by the VM.
239      *
240      * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
241      *
242      * @see Method#isObsolete
243      * @see ThreadReference#popFrames
244      * @see #canRedefineClasses
245      * @see #canAddMethod
246      * @see #canUnrestrictedlyRedefineClasses
247      *
248      * @since 1.4
249      */
250     void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes);
251 
252     /**
253      * Returns a list of the live
254      * <a href="{@docRoot}/java.base/java/lang/Thread.html#platform-threads">platform
255      * threads</a> in the target VM. The returned list contains a {@link ThreadReference}
256      * mirror for each live platform thread that is attached to the VM. The list does
257      * not contain elements for virtual threads.
258      * <p>
259      * The returned list contains the platform threads created with the {@link Thread}
260      * API, and all native threads attached to the target VM through JNI.
261      * Thread objects that have not yet been started
262      * (see {@link java.lang.Thread#start Thread.start()})
263      * and thread objects that have
264      * completed their execution are not included in the returned list.
265      *
266      * @return a list of {@link ThreadReference} objects, one for each
267      * live platform thread in the mirrored VM.
268      */
269     List<ThreadReference> allThreads();
270 
271     /**
272      * Suspends the execution of the application running in this
273      * virtual machine. All threads currently running will be suspended.
274      * <p>
275      * Unlike {@link java.lang.Thread#suspend Thread.suspend()},
276      * suspends of both the virtual machine and individual threads are
277      * counted. Before a thread will run again, it must be resumed
278      * (through {@link #resume} or {@link ThreadReference#resume})
279      * the same number of times it has been suspended.
280      *
281      * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
282      */
283     void suspend();
284 
285     /**
286      * Continues the execution of the application running in this
287      * virtual machine. All threads are resumed as documented in

769     boolean canGetConstantPool();
770 
771     /**
772      * Determines if the target VM supports getting information about modules.
773      *
774      * @return {@code true} if the feature is supported, {@code false} otherwise
775      *
776      * @implSpec
777      * The default implementation returns {@code false}.
778      *
779      * @see VirtualMachine#allModules()
780      * @see ReferenceType#module()
781      * @see ModuleReference
782      *
783      * @since 9
784      */
785     default boolean canGetModuleInfo() {
786         return false;
787     }
788 
789     /**
790      * Determine if the target VM support virtual threads.
791      *
792      * @return {@code true} if the feature is supported, {@code false} otherwise
793      *
794      * @apiNote
795      * This is a temporary method to test the capability of the target VM.
796      *
797      * @implSpec
798      * The default implementation returns {@code false}.
799      *
800      * @since 99
801      */
802     default boolean supportsVirtualThreads() {
803         return false;
804     }
805 
806     /**
807      * Set this VM's default stratum (see {@link Location} for a
808      * discussion of strata).  Overrides the per-class default set
809      * in the class file.
810      * <P>
811      * Affects location queries (such as,
812      * {@link Location#sourceName()})
813      * and the line boundaries used in
814      * single stepping.
815      *
816      * @param stratum the stratum to set as VM default,
817      * or null to use per-class defaults.
818      *
819      * @throws java.lang.UnsupportedOperationException if the
820      * target virtual machine does not support this operation.
821      *
822      * @since 1.4
823      */
824     void setDefaultStratum(String stratum);
825 
< prev index next >