View Javadoc
1   /*
2    * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
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.
8    *
9    * This code is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11   * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12   * version 2 for more details (a copy is included in the LICENSE file that
13   * accompanied this code).
14   *
15   * You should have received a copy of the GNU General Public License version
16   * 2 along with this work; if not, write to the Free Software Foundation,
17   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18   *
19   * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20   * or visit if you need additional information or have any
21   * questions.
22   *
23   */
25  package sun.jvm.hotspot.debugger;
27  /** <P> This interface abstracts over access to operating system-level
28      threads in the underlying process. It is designed to be minimal
29      and generic to allow cross-platform compatibility. </P>
31      <P> The basic operation this interface supports is creating a
32      sun.jvm.hotspot.debugger.ThreadProxy "token" for an existing
33      thread. As an example, the HotSpot VM contains a list of Java
34      threads, encapsulated in VM-specific JavaThread objects. Each of
35      these contains a platform-dependent field with the OS-level thread
36      identifier; on Solaris, this field's type is "thread_t", while on
37      Windows, it is HANDLE. It is necessary to be able to map from
38      these fields to a ThreadProxy object, in particular to be able to
39      get the thread's context. However, since the types of these fields
40      vary greatly from OS to OS (some use integers as thread IDs, some
41      use pointers as thread handles) it is not possible to define one
42      particular type (Address, long) in this interface as the lookup
43      "key" for a Thread. </P>
45      <P> For this reason this mapping mechanism takes the Address of
46      the memory location containing the thread identifier. On Solaris,
47      this is the address of a location containing a thread_t; on
48      Windows, this is the address of a location containing a HANDLE for
49      a thread. On Linux, this is the address of a location containing a
50      pthread_t.</P>
52      <P> The {@link sun.jvm.hotspot.debugger.cdbg.CDebugger} interface
53      provides access to the entire thread list of the target process,
54      but this is optional functionality not required to get the SA to
55      work. </P> */
57  public interface ThreadAccess {
58    /** Gets an abstract ThreadProxy object for the thread identified by
59        the contents of the memory location pointed to by addr. The
60        contents at location addr are inherently platform-dependent; see
61        the documentation for this class for more information. FIXME:
62        what exception, if any, should this throw? */
63    public ThreadProxy getThreadForIdentifierAddress(Address addr);
65    /** Gets an abstract ThreadProxy object for the thread identified by
66        id or handle that is platform dependent */
67    public ThreadProxy getThreadForThreadId(long id);
68  }