Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/ThreadProxy.java
41161 views
/*1* Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324package sun.jvm.hotspot.debugger;2526/** <P> This interface abstracts raw access to operating system-level27threads. In a debugging environment these methods map to, for28example, thread_db calls on Solaris (see /usr/include/thread_db.h)29or the Win32 debugging API calls. In a runtime environment these30might map directly to pthread calls. </P>3132<P> Implementors of this interface must provide equals() and33hashCode() methods which work properly regardless of how the34ThreadProxy is obtained, in particular either through {@link35sun.jvm.hotspot.debugger.ThreadAccess} or the thread list provided36by {@link sun.jvm.hotspot.debugger.cdbg.CDebugger}. This allows37matching up of the OS's notion of the thread list of the target38process with any user-level lists that may be present (i.e., the39JavaThread list in the HotSpot VM). </P>4041<P> Implementors of this interface should also provide a42toString() which converts the ThreadProxy to a value easily43recognizable in the platform's debugger. (For example, on Solaris,44"t@<id>".) </P>4546<P> FIXME: had to be renamed from "Thread" to avoid numerous47clashes with java.lang.Thread -- would be nice to pick a more48consistent name with the rest of the system. </P> */4950public interface ThreadProxy {51/** Retrieves the context for the given thread. It is only valid to52call this method if the thread is suspended (i.e., the process53has not been resumed via ProcessControl); throws an54IllegalThreadStateException if it is not. */55public ThreadContext getContext() throws IllegalThreadStateException;5657/** Indicates whether calls to setContext() are valid. */58public boolean canSetContext() throws DebuggerException;5960/** Sets the context for the given thread. The passed ThreadContext61must be a modified version of one returned from a previous call62to getContext(). It is only valid to call this method if the63thread is suspended (i.e., the process has not been resumed via64ProcessControl); throws an IllegalThreadStateException if it is65not. Throws a DebuggerException if the target process can not be66modified, for example because it is a core file. */67public void setContext(ThreadContext context)68throws IllegalThreadStateException, DebuggerException;69}707172