annotate agent/src/share/classes/sun/jvm/hotspot/debugger/cdbg/ProcessControl.java @ 1552:c18cbe5936b8

6941466: Oracle rebranding changes for Hotspot repositories Summary: Change all the Sun copyrights to Oracle copyright Reviewed-by: ohair
author trims
date Thu, 27 May 2010 19:08:38 -0700
parents a61af66fc99e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.debugger.cdbg;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 /** <P> A highly experimental interface for process control and debug
a61af66fc99e Initial load
duke
parents:
diff changeset
30 events. May not be sufficiently portable; for this reason it has
a61af66fc99e Initial load
duke
parents:
diff changeset
31 been factored out from the CDebugger interface and support for it
a61af66fc99e Initial load
duke
parents:
diff changeset
32 is optional. </P>
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 <P> The ProcessControl interface defines a process control and
a61af66fc99e Initial load
duke
parents:
diff changeset
35 event model for debugging. When a process is attached to by the
a61af66fc99e Initial load
duke
parents:
diff changeset
36 base Debugger, all threads in the target process are suspended.
a61af66fc99e Initial load
duke
parents:
diff changeset
37 The ProcessControl interface allows resumption and re-suspension
a61af66fc99e Initial load
duke
parents:
diff changeset
38 of the threads in the target process, setting of breakpoints, and
a61af66fc99e Initial load
duke
parents:
diff changeset
39 reception of debugging events (breakpoint hit, signal received,
a61af66fc99e Initial load
duke
parents:
diff changeset
40 etc.). </P>
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 <P> Debugging events are generated one at a time by the target
a61af66fc99e Initial load
duke
parents:
diff changeset
43 process. They must be queued up by the underlying debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
44 mechanism so that an attempt to send a second debugging event
a61af66fc99e Initial load
duke
parents:
diff changeset
45 blocks until the first has been serviced with a call to
a61af66fc99e Initial load
duke
parents:
diff changeset
46 debugEventResume. </P> */
a61af66fc99e Initial load
duke
parents:
diff changeset
47
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public interface ProcessControl {
a61af66fc99e Initial load
duke
parents:
diff changeset
49 /** Suspends all threads in the target process. A process is already
a61af66fc99e Initial load
duke
parents:
diff changeset
50 suspended when attached to by {@link
a61af66fc99e Initial load
duke
parents:
diff changeset
51 sun.jvm.hotspot.debugger.Debugger.attach(int)}. The application
a61af66fc99e Initial load
duke
parents:
diff changeset
52 should check for the presence of a debug event via
a61af66fc99e Initial load
duke
parents:
diff changeset
53 debugEventPoll() upon re-suspending the target process (if one
a61af66fc99e Initial load
duke
parents:
diff changeset
54 is not yet known to be present.)
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 @throw DebuggerException if the process is already suspended or
a61af66fc99e Initial load
duke
parents:
diff changeset
57 if the suspension failed for some other reason. */
a61af66fc99e Initial load
duke
parents:
diff changeset
58 public void suspend() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 /** Resumes all threads in the target process.
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 @throw DebuggerException if the process is not suspended or if
a61af66fc99e Initial load
duke
parents:
diff changeset
63 the resumption failed for some other reason. */
a61af66fc99e Initial load
duke
parents:
diff changeset
64 public void resume() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 /** Indicates whether the target process is suspended. */
a61af66fc99e Initial load
duke
parents:
diff changeset
67 public boolean isSuspended() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 /** Sets a breakpoint at the given address. The target process must
a61af66fc99e Initial load
duke
parents:
diff changeset
70 be suspended in order to set a breakpoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 @throw DebuggerException if the breakpoint could not be set for
a61af66fc99e Initial load
duke
parents:
diff changeset
73 some reason, including that a breakpoint is already set at that
a61af66fc99e Initial load
duke
parents:
diff changeset
74 address or that the underlying debugging mechanism does not
a61af66fc99e Initial load
duke
parents:
diff changeset
75 support that many breakpoints. */
a61af66fc99e Initial load
duke
parents:
diff changeset
76 public void setBreakpoint(Address addr)
a61af66fc99e Initial load
duke
parents:
diff changeset
77 throws UnmappedAddressException, DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 /** Clears a breakpoint at the given address. The target process
a61af66fc99e Initial load
duke
parents:
diff changeset
80 must be suspended in order to clear a breakpoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 @throw DebuggerException if the breakpoint could not be cleared
a61af66fc99e Initial load
duke
parents:
diff changeset
83 for some reason, including that there was no breakpoint at that
a61af66fc99e Initial load
duke
parents:
diff changeset
84 address. */
a61af66fc99e Initial load
duke
parents:
diff changeset
85 public void clearBreakpoint(Address addr) throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 /** Indicates whether a breakpoint is set at the given address. */
a61af66fc99e Initial load
duke
parents:
diff changeset
88 public boolean isBreakpointSet(Address addr) throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 /** Polls for the presence of a debug event. Does not wait for one
a61af66fc99e Initial load
duke
parents:
diff changeset
91 to be generated; returns null if none was pending. The target
a61af66fc99e Initial load
duke
parents:
diff changeset
92 process does not need to be suspended. Returns the same
a61af66fc99e Initial load
duke
parents:
diff changeset
93 DebugEvent object until the debug event is handled via
a61af66fc99e Initial load
duke
parents:
diff changeset
94 debugEventContinue. Typically the application will suspend the
a61af66fc99e Initial load
duke
parents:
diff changeset
95 target process upon reception of a debug event but before
a61af66fc99e Initial load
duke
parents:
diff changeset
96 handling it via a call to debugEventContinue. This ensures that
a61af66fc99e Initial load
duke
parents:
diff changeset
97 the state of the thread which generated the debug event is
a61af66fc99e Initial load
duke
parents:
diff changeset
98 precisely what it was when the event was generated.
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 @return The pending debug event, or null if none pending. */
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public DebugEvent debugEventPoll() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 /** Informs the target process to resume past this debug event. The
a61af66fc99e Initial load
duke
parents:
diff changeset
104 target process does not need to be suspended. Breakpoint debug
a61af66fc99e Initial load
duke
parents:
diff changeset
105 events must be handled transparently by the implementation to
a61af66fc99e Initial load
duke
parents:
diff changeset
106 re-execute the instruction and replace the breakpoint. (Ideally
a61af66fc99e Initial load
duke
parents:
diff changeset
107 they should be replaced in such a way that there is no race
a61af66fc99e Initial load
duke
parents:
diff changeset
108 condition between the re-execution and the re-insertion of the
a61af66fc99e Initial load
duke
parents:
diff changeset
109 breakpoint.) All other kinds of exceptions or signals are passed
a61af66fc99e Initial load
duke
parents:
diff changeset
110 on to the target process.
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 @throw DebuggerException if no debug event is pending. */
a61af66fc99e Initial load
duke
parents:
diff changeset
113 public void debugEventContinue()
a61af66fc99e Initial load
duke
parents:
diff changeset
114 throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }