annotate agent/src/share/classes/sun/jvm/hotspot/debugger/win32/Win32CDebugger.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 c18cbe5936b8
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 2001-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.win32;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.debugger.cdbg.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 import sun.jvm.hotspot.debugger.cdbg.basic.x86.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 import sun.jvm.hotspot.debugger.x86.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 import sun.jvm.hotspot.utilities.AddressOps;
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 class Win32CDebugger implements CDebugger, ProcessControl {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // FIXME: think about how to make this work in a remote debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // scenario; who should keep open DLLs? Need local copies of these
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // DLLs on the debugging machine?
a61af66fc99e Initial load
duke
parents:
diff changeset
39 private Win32Debugger dbg;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 Win32CDebugger(Win32Debugger dbg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 this.dbg = dbg;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 }
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 public List getThreadList() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 return dbg.getThreadList();
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException{
a61af66fc99e Initial load
duke
parents:
diff changeset
50 return dbg.getLoadObjectList();
a61af66fc99e Initial load
duke
parents:
diff changeset
51 }
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // FIXME: could keep sorted list of these to be able to do binary
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // searches, for better scalability
a61af66fc99e Initial load
duke
parents:
diff changeset
56 if (pc == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 List objs = getLoadObjectList();
a61af66fc99e Initial load
duke
parents:
diff changeset
60 for (Iterator iter = objs.iterator(); iter.hasNext(); ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 LoadObject obj = (LoadObject) iter.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 return obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 return null;
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 CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 X86ThreadContext context = (X86ThreadContext) thread.getContext();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 Address ebp = context.getRegisterAsAddress(X86ThreadContext.EBP);
a61af66fc99e Initial load
duke
parents:
diff changeset
72 if (ebp == null) return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 if (pc == null) return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
75 return new X86CFrame(this, ebp, pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 public String getNameOfFile(String fileName) {
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return new File(fileName).getName();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 public ProcessControl getProcessControl() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 return this;
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // C++ name demangling
a61af66fc99e Initial load
duke
parents:
diff changeset
87 public boolean canDemangle() {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 public String demangle(String sym) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 throw new UnsupportedOperationException();
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 //
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Support for ProcessControl interface
a61af66fc99e Initial load
duke
parents:
diff changeset
97 //
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 public void suspend() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 dbg.suspend();
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 public void resume() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 dbg.resume();
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 public boolean isSuspended() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 return dbg.isSuspended();
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 public void setBreakpoint(Address addr) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 dbg.setBreakpoint(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 public void clearBreakpoint(Address addr) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 dbg.clearBreakpoint(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 public boolean isBreakpointSet(Address addr) throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 return dbg.isBreakpointSet(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117 public DebugEvent debugEventPoll() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 return dbg.debugEventPoll();
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 public void debugEventContinue() throws DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 dbg.debugEventContinue();
a61af66fc99e Initial load
duke
parents:
diff changeset
122 }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }