Path: blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/ThreadAccess.java
41161 views
/*1* Copyright (c) 2000, 2003, 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 over access to operating system-level27threads in the underlying process. It is designed to be minimal28and generic to allow cross-platform compatibility. </P>2930<P> The basic operation this interface supports is creating a31sun.jvm.hotspot.debugger.ThreadProxy "token" for an existing32thread. As an example, the HotSpot VM contains a list of Java33threads, encapsulated in VM-specific JavaThread objects. Each of34these contains a platform-dependent field with the OS-level thread35identifier; on Solaris, this field's type is "thread_t", while on36Windows, it is HANDLE. It is necessary to be able to map from37these fields to a ThreadProxy object, in particular to be able to38get the thread's context. However, since the types of these fields39vary greatly from OS to OS (some use integers as thread IDs, some40use pointers as thread handles) it is not possible to define one41particular type (Address, long) in this interface as the lookup42"key" for a Thread. </P>4344<P> For this reason this mapping mechanism takes the Address of45the memory location containing the thread identifier. On Solaris,46this is the address of a location containing a thread_t; on47Windows, this is the address of a location containing a HANDLE for48a thread. On Linux, this is the address of a location containing a49pthread_t.</P>5051<P> The {@link sun.jvm.hotspot.debugger.cdbg.CDebugger} interface52provides access to the entire thread list of the target process,53but this is optional functionality not required to get the SA to54work. </P> */5556public interface ThreadAccess {57/** Gets an abstract ThreadProxy object for the thread identified by58the contents of the memory location pointed to by addr. The59contents at location addr are inherently platform-dependent; see60the documentation for this class for more information. FIXME:61what exception, if any, should this throw? */62public ThreadProxy getThreadForIdentifierAddress(Address addr);6364/** Gets an abstract ThreadProxy object for the thread identified by65id or handle that is platform dependent */66public ThreadProxy getThreadForThreadId(long id);67}686970