annotate agent/src/share/classes/sun/jvm/hotspot/debugger/Debugger.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2000-2002 Sun Microsystems, Inc. All Rights Reserved.
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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import sun.jvm.hotspot.debugger.cdbg.CDebugger;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 public interface Debugger extends SymbolLookup, ThreadAccess {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 /** Indicates whether this underlying debugger can provide a list of
a61af66fc99e Initial load
duke
parents:
diff changeset
32 currently-running processes. */
a61af66fc99e Initial load
duke
parents:
diff changeset
33 public boolean hasProcessList() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 /** Provide a snapshot of the list of currently-running processes in
a61af66fc99e Initial load
duke
parents:
diff changeset
36 the form of a List of ProcessInfo objects. Must only be called
a61af66fc99e Initial load
duke
parents:
diff changeset
37 if hasProcessList(), above, returns true. */
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public List getProcessList() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 /** If an error occurs during attachment (i.e., "no such process"),
a61af66fc99e Initial load
duke
parents:
diff changeset
41 the thrown DebuggerException will contain a description of the
a61af66fc99e Initial load
duke
parents:
diff changeset
42 error in its message string. */
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public void attach(int processID) throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 /** This attaches the debugger to the given coreFileName, which is
a61af66fc99e Initial load
duke
parents:
diff changeset
46 assumed to have been generated from the specified
a61af66fc99e Initial load
duke
parents:
diff changeset
47 executableName. If an error occurs during loading of the core
a61af66fc99e Initial load
duke
parents:
diff changeset
48 file (i.e., "no such file"), the thrown DebuggerException will
a61af66fc99e Initial load
duke
parents:
diff changeset
49 contain a description of the error in its message string. */
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public void attach(String executableName, String coreFileName)
a61af66fc99e Initial load
duke
parents:
diff changeset
51 throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 /** Detach from the remote process. Returns false if not currently
a61af66fc99e Initial load
duke
parents:
diff changeset
54 attached. */
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public boolean detach() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 /** Parse an address from a hex string in the format "0xFFFFFFFF".
a61af66fc99e Initial load
duke
parents:
diff changeset
58 The length of the address (i.e., 32 or 64 bits) is platform
a61af66fc99e Initial load
duke
parents:
diff changeset
59 dependent. This method should ONLY be used by routines which
a61af66fc99e Initial load
duke
parents:
diff changeset
60 need to interact with the user and parse a string entered by
a61af66fc99e Initial load
duke
parents:
diff changeset
61 hand; for example, a graphical user interface. This routine
a61af66fc99e Initial load
duke
parents:
diff changeset
62 should NOT be used to subvert the current safety mechanisms in
a61af66fc99e Initial load
duke
parents:
diff changeset
63 the system which prevent arbitrary conversion from Address to
a61af66fc99e Initial load
duke
parents:
diff changeset
64 long and back. */
a61af66fc99e Initial load
duke
parents:
diff changeset
65 public Address parseAddress(String addressString)
a61af66fc99e Initial load
duke
parents:
diff changeset
66 throws NumberFormatException, DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 /** Returns the 64-bit value of an Address. This method should ONLY
a61af66fc99e Initial load
duke
parents:
diff changeset
69 be used when implementing a debugger which needs to interface to
a61af66fc99e Initial load
duke
parents:
diff changeset
70 C and which needs a unique identifier for certain objects. */
a61af66fc99e Initial load
duke
parents:
diff changeset
71 public long getAddressValue(Address addr) throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 /** Support for remote debugging. Get the name of the operating
a61af66fc99e Initial load
duke
parents:
diff changeset
74 system on which this debugger is running (to be able to properly
a61af66fc99e Initial load
duke
parents:
diff changeset
75 configure the local system). Typical return values are
a61af66fc99e Initial load
duke
parents:
diff changeset
76 "solaris", "linux", "win32"; see utilities/PlatformInfo.java. */
a61af66fc99e Initial load
duke
parents:
diff changeset
77 public String getOS() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 /** Support for remote debugging. Get the name of the CPU type on
a61af66fc99e Initial load
duke
parents:
diff changeset
80 which this debugger is running (to be able to properly configure
a61af66fc99e Initial load
duke
parents:
diff changeset
81 the local system). Typical return values are "sparc", "x86"; see
a61af66fc99e Initial load
duke
parents:
diff changeset
82 utilities/PlatformInfo.java. */
a61af66fc99e Initial load
duke
parents:
diff changeset
83 public String getCPU() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 /** Retrieve the machine description for the underlying hardware for
a61af66fc99e Initial load
duke
parents:
diff changeset
86 the cases in which we need to do, for example, machine-dependent
a61af66fc99e Initial load
duke
parents:
diff changeset
87 byte swapping */
a61af66fc99e Initial load
duke
parents:
diff changeset
88 public MachineDescription getMachineDescription() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 /** Find out whether this debugger has a console available on which
a61af66fc99e Initial load
duke
parents:
diff changeset
91 commands can be executed; see executeCommandOnConsole, below.
a61af66fc99e Initial load
duke
parents:
diff changeset
92 This is an interim routine designed to allow access to the
a61af66fc99e Initial load
duke
parents:
diff changeset
93 underlying dbx process on Solaris until we have disassembly,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 etc. in the SA. */
a61af66fc99e Initial load
duke
parents:
diff changeset
95 public boolean hasConsole() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 /** If the underlying debugger has a console (as dbx does), this
a61af66fc99e Initial load
duke
parents:
diff changeset
98 provides access to it. Takes in a platform-dependent String,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 executes it on the debugger's console, and returns any output as
a61af66fc99e Initial load
duke
parents:
diff changeset
100 a String. */
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public String consoleExecuteCommand(String cmd) throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 /** If the underlying debugger has a console, this returns the
a61af66fc99e Initial load
duke
parents:
diff changeset
104 debugger-specific prompt which should be displayed. */
a61af66fc99e Initial load
duke
parents:
diff changeset
105 public String getConsolePrompt() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 /** If this platform supports C/C++ debugging via the CDebugger
a61af66fc99e Initial load
duke
parents:
diff changeset
108 interface, returns a CDebugger object; otherwise returns
a61af66fc99e Initial load
duke
parents:
diff changeset
109 null. */
a61af66fc99e Initial load
duke
parents:
diff changeset
110 public CDebugger getCDebugger() throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
111
a61af66fc99e Initial load
duke
parents:
diff changeset
112 /** the following methods are intended only for RemoteDebuggerClient */
a61af66fc99e Initial load
duke
parents:
diff changeset
113 public long getJBooleanSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
114 public long getJByteSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
115 public long getJCharSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
116 public long getJDoubleSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
117 public long getJFloatSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 public long getJIntSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
119 public long getJLongSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public long getJShortSize();
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
121 public long getHeapBase();
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
122 public long getHeapOopSize();
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
123 public long getLogMinObjAlignmentInBytes();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 public ReadResult readBytesFromProcess(long address, long numBytes)
a61af66fc99e Initial load
duke
parents:
diff changeset
126 throws DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 public void writeBytesToProcess(long address, long numBytes, byte[] data)
a61af66fc99e Initial load
duke
parents:
diff changeset
129 throws UnmappedAddressException, DebuggerException;
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }