Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java @ 1913:3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
Summary: Allow CONSTANT_InvokeDynamic nodes to have any number of extra operands.
Reviewed-by: twisti
author | jrose |
---|---|
date | Sat, 30 Oct 2010 13:08:23 -0700 |
parents | c18cbe5936b8 |
children | 78332b46e604 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
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 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.debugger.windbg; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
30 import sun.jvm.hotspot.debugger.cdbg.*; | |
31 import sun.jvm.hotspot.debugger.cdbg.basic.x86.*; | |
32 import sun.jvm.hotspot.debugger.cdbg.basic.amd64.*; | |
33 import sun.jvm.hotspot.debugger.x86.*; | |
34 import sun.jvm.hotspot.debugger.amd64.*; | |
35 import sun.jvm.hotspot.utilities.AddressOps; | |
36 | |
37 class WindbgCDebugger implements CDebugger { | |
38 // FIXME: think about how to make this work in a remote debugging | |
39 // scenario; who should keep open DLLs? Need local copies of these | |
40 // DLLs on the debugging machine? | |
41 private WindbgDebugger dbg; | |
42 | |
43 WindbgCDebugger(WindbgDebugger dbg) { | |
44 this.dbg = dbg; | |
45 } | |
46 | |
47 public List getThreadList() throws DebuggerException { | |
48 return dbg.getThreadList(); | |
49 } | |
50 | |
51 public List/*<LoadObject>*/ getLoadObjectList() throws DebuggerException{ | |
52 return dbg.getLoadObjectList(); | |
53 } | |
54 | |
55 public LoadObject loadObjectContainingPC(Address pc) throws DebuggerException { | |
56 // FIXME: could keep sorted list of these to be able to do binary | |
57 // searches, for better scalability | |
58 if (pc == null) { | |
59 return null; | |
60 } | |
61 List objs = getLoadObjectList(); | |
62 for (Iterator iter = objs.iterator(); iter.hasNext(); ) { | |
63 LoadObject obj = (LoadObject) iter.next(); | |
64 if (AddressOps.lte(obj.getBase(), pc) && (pc.minus(obj.getBase()) < obj.getSize())) { | |
65 return obj; | |
66 } | |
67 } | |
68 return null; | |
69 } | |
70 | |
71 public CFrame topFrameForThread(ThreadProxy thread) throws DebuggerException { | |
72 if (dbg.getCPU().equals("x86")) { | |
73 X86ThreadContext context = (X86ThreadContext) thread.getContext(); | |
74 Address ebp = context.getRegisterAsAddress(X86ThreadContext.EBP); | |
75 if (ebp == null) return null; | |
76 Address pc = context.getRegisterAsAddress(X86ThreadContext.EIP); | |
77 if (pc == null) return null; | |
78 return new X86CFrame(this, ebp, pc); | |
79 } else if (dbg.getCPU().equals("amd64")) { | |
80 AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); | |
81 Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); | |
82 if (rbp == null) return null; | |
83 Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); | |
84 if (pc == null) return null; | |
85 return new AMD64CFrame(this, rbp, pc); | |
86 } else { | |
87 // unsupported CPU! | |
88 return null; | |
89 } | |
90 } | |
91 | |
92 public String getNameOfFile(String fileName) { | |
93 return new File(fileName).getName(); | |
94 } | |
95 | |
96 public ProcessControl getProcessControl() throws DebuggerException { | |
97 return null; | |
98 } | |
99 | |
100 // C++ name demangling | |
101 public boolean canDemangle() { | |
102 return false; | |
103 } | |
104 | |
105 public String demangle(String sym) { | |
106 throw new UnsupportedOperationException(); | |
107 } | |
108 } |