annotate agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerServer.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 2002-2003 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.remote;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.rmi.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.rmi.server.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 /** The implementation of the RemoteDebugger interface. This
a61af66fc99e Initial load
duke
parents:
diff changeset
33 delegates to a local debugger */
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 public class RemoteDebuggerServer extends UnicastRemoteObject
a61af66fc99e Initial load
duke
parents:
diff changeset
36 implements RemoteDebugger {
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 private transient Debugger debugger;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 /** This is the required no-arg constructor */
a61af66fc99e Initial load
duke
parents:
diff changeset
41 public RemoteDebuggerServer() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 super();
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 /** This is the constructor used on the machine where the debuggee
a61af66fc99e Initial load
duke
parents:
diff changeset
46 process lies */
a61af66fc99e Initial load
duke
parents:
diff changeset
47 public RemoteDebuggerServer(Debugger debugger) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 super();
a61af66fc99e Initial load
duke
parents:
diff changeset
49 this.debugger = debugger;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 public String getOS() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return debugger.getOS();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 public String getCPU() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 return debugger.getCPU();
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 public MachineDescription getMachineDescription() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 return debugger.getMachineDescription();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 public long lookupInProcess(String objectName, String symbol) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 Address addr = debugger.lookup(objectName, symbol);
a61af66fc99e Initial load
duke
parents:
diff changeset
66 return addr == null? 0L : debugger.getAddressValue(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public ReadResult readBytesFromProcess(long address, long numBytes) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 return debugger.readBytesFromProcess(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public boolean hasConsole() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 return debugger.hasConsole();
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 public String getConsolePrompt() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 return debugger.getConsolePrompt();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 public String consoleExecuteCommand(String cmd) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 return debugger.consoleExecuteCommand(cmd);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 public long getJBooleanSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 return debugger.getJBooleanSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 public long getJByteSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 return debugger.getJByteSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 public long getJCharSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 return debugger.getJCharSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 public long getJDoubleSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 return debugger.getJDoubleSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 public long getJFloatSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 return debugger.getJFloatSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 public long getJIntSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return debugger.getJIntSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 public long getJLongSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 return debugger.getJLongSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 public long getJShortSize() throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 return debugger.getJShortSize();
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
117 public long getHeapBase() throws RemoteException {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
118 return debugger.getHeapBase();
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
119 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
120
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
121 public long getHeapOopSize() throws RemoteException {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
122 return debugger.getHeapOopSize();
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
123 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
124
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
125 public long getLogMinObjAlignmentInBytes() throws RemoteException {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
126 return debugger.getLogMinObjAlignmentInBytes();
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
127 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
128 public boolean areThreadsEqual(long addrOrId1, boolean isAddress1,
a61af66fc99e Initial load
duke
parents:
diff changeset
129 long addrOrId2, boolean isAddress2) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 ThreadProxy t1 = getThreadProxy(addrOrId1, isAddress1);
a61af66fc99e Initial load
duke
parents:
diff changeset
131 ThreadProxy t2 = getThreadProxy(addrOrId2, isAddress2);
a61af66fc99e Initial load
duke
parents:
diff changeset
132 return t1.equals(t2);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 public int getThreadHashCode(long addrOrId, boolean isAddress) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
137 ThreadProxy t = getThreadProxy(addrOrId, isAddress);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 return t.hashCode();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 public long[] getThreadIntegerRegisterSet(long addrOrId, boolean isAddress) throws RemoteException {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 ThreadProxy t = getThreadProxy(addrOrId, isAddress);
a61af66fc99e Initial load
duke
parents:
diff changeset
143 ThreadContext tc = t.getContext();
a61af66fc99e Initial load
duke
parents:
diff changeset
144 long[] regs = new long[tc.getNumRegisters()];
a61af66fc99e Initial load
duke
parents:
diff changeset
145 for (int r = 0; r < regs.length; r++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 regs[r] = tc.getRegister(r);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 return regs;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 }
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 private ThreadProxy getThreadProxy(long addrOrId, boolean isAddress) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 if (isAddress) {
a61af66fc99e Initial load
duke
parents:
diff changeset
153 Address addr = debugger.parseAddress("0x" + Long.toHexString(addrOrId));
a61af66fc99e Initial load
duke
parents:
diff changeset
154 return debugger.getThreadForIdentifierAddress(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
155 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 return debugger.getThreadForThreadId(addrOrId);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }