0
|
1 /*
|
|
2 * Copyright 2000-2002 Sun Microsystems, Inc. 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.
|
|
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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 package sun.jvm.hotspot.debugger;
|
|
26
|
|
27 /** <P> This interface abstracts raw access to operating system-level
|
|
28 threads. In a debugging environment these methods map to, for
|
|
29 example, thread_db calls on Solaris (see /usr/include/thread_db.h)
|
|
30 or the Win32 debugging API calls. In a runtime environment these
|
|
31 might map directly to pthread calls. </P>
|
|
32
|
|
33 <P> Implementors of this interface must provide equals() and
|
|
34 hashCode() methods which work properly regardless of how the
|
|
35 ThreadProxy is obtained, in particular either through {@link
|
|
36 sun.jvm.hotspot.debugger.ThreadAccess} or the thread list provided
|
|
37 by {@link sun.jvm.hotspot.debugger.cdbg.CDebugger}. This allows
|
|
38 matching up of the OS's notion of the thread list of the target
|
|
39 process with any user-level lists that may be present (i.e., the
|
|
40 JavaThread list in the HotSpot VM). </P>
|
|
41
|
|
42 <P> Implementors of this interface should also provide a
|
|
43 toString() which converts the ThreadProxy to a value easily
|
|
44 recognizable in the platform's debugger. (For example, on Solaris,
|
|
45 "t@<id>".) </P>
|
|
46
|
|
47 <P> FIXME: had to be renamed from "Thread" to avoid numerous
|
|
48 clashes with java.lang.Thread -- would be nice to pick a more
|
|
49 consistent name with the rest of the system. </P> */
|
|
50
|
|
51 public interface ThreadProxy {
|
|
52 /** Retrieves the context for the given thread. It is only valid to
|
|
53 call this method if the thread is suspended (i.e., the process
|
|
54 has not been resumed via ProcessControl); throws an
|
|
55 IllegalThreadStateException if it is not. */
|
|
56 public ThreadContext getContext() throws IllegalThreadStateException;
|
|
57
|
|
58 /** Indicates whether calls to setContext() are valid. */
|
|
59 public boolean canSetContext() throws DebuggerException;
|
|
60
|
|
61 /** Sets the context for the given thread. The passed ThreadContext
|
|
62 must be a modified version of one returned from a previous call
|
|
63 to getContext(). It is only valid to call this method if the
|
|
64 thread is suspended (i.e., the process has not been resumed via
|
|
65 ProcessControl); throws an IllegalThreadStateException if it is
|
|
66 not. Throws a DebuggerException if the target process can not be
|
|
67 modified, for example because it is a core file. */
|
|
68 public void setContext(ThreadContext context)
|
|
69 throws IllegalThreadStateException, DebuggerException;
|
|
70 }
|