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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.debugger.windbg;
26
27 import java.io.*;
28 import java.net.*;
29 import java.util.*;
30 import sun.jvm.hotspot.debugger.*;
31 import sun.jvm.hotspot.debugger.amd64.*;
32 import sun.jvm.hotspot.debugger.x86.*;
33 import sun.jvm.hotspot.debugger.windbg.amd64.*;
34 import sun.jvm.hotspot.debugger.windbg.x86.*;
35 import sun.jvm.hotspot.debugger.win32.coff.*;
36 import sun.jvm.hotspot.debugger.cdbg.*;
37 import sun.jvm.hotspot.debugger.cdbg.basic.BasicDebugEvent;
38 import sun.jvm.hotspot.utilities.*;
39 import sun.jvm.hotspot.utilities.memo.*;
40 import sun.jvm.hotspot.runtime.*;
41
42 /** <P> An implementation of the JVMDebugger interface which talks to
43 windbg and symbol table management is done in Java. </P>
44
45 <P> <B>NOTE</B> that since we have the notion of fetching "Java
46 primitive types" from the remote process (which might have
47 different sizes than we expect) we have a bootstrapping
48 problem. We need to know the sizes of these types before we can
49 fetch them. The current implementation solves this problem by
50 requiring that it be configured with these type sizes before they
51 can be fetched. The readJ(Type) routines here will throw a
52 RuntimeException if they are called before the debugger is
96 utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian()) {
97 public void checkAlignment(long address, long alignment) {
98 // Need to override default checkAlignment because we need to
99 // relax alignment constraints on Windows/x86
100 if ( (address % alignment != 0)
101 &&(alignment != 8 || address % 4 != 0)) {
102 throw new UnalignedAddressException(
103 "Trying to read at address: "
104 + addressValueToString(address)
105 + " with alignment: " + alignment,
106 address);
107 }
108 }
109 };
110
111 String cpu = PlatformInfo.getCPU();
112 if (cpu.equals("x86")) {
113 threadFactory = new WindbgX86ThreadFactory(this);
114 } else if (cpu.equals("amd64")) {
115 threadFactory = new WindbgAMD64ThreadFactory(this);
116 }
117
118 if (useCache) {
119 // Cache portion of the remote process's address space.
120 // Fetching data over the socket connection to dbx is slow.
121 // Might be faster if we were using a binary protocol to talk to
122 // dbx, but would have to test. For now, this cache works best
123 // if it covers the entire heap of the remote process. FIXME: at
124 // least should make this tunable from the outside, i.e., via
125 // the UI. This is a cache of 4096 4K pages, or 16 MB. The page
126 // size must be adjusted to be the hardware's page size.
127 // (FIXME: should pick this up from the debugger.)
128 initCache(4096, 4096);
129 }
130 // FIXME: add instantiation of thread factory
131
132 }
133
134 /** From the Debugger interface via JVMDebugger */
135 public boolean hasProcessList() throws DebuggerException {
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 package sun.jvm.hotspot.debugger.windbg;
26
27 import java.io.*;
28 import java.net.*;
29 import java.util.*;
30 import sun.jvm.hotspot.debugger.*;
31 import sun.jvm.hotspot.debugger.aarch64.*;
32 import sun.jvm.hotspot.debugger.amd64.*;
33 import sun.jvm.hotspot.debugger.x86.*;
34 import sun.jvm.hotspot.debugger.windbg.aarch64.*;
35 import sun.jvm.hotspot.debugger.windbg.amd64.*;
36 import sun.jvm.hotspot.debugger.windbg.x86.*;
37 import sun.jvm.hotspot.debugger.win32.coff.*;
38 import sun.jvm.hotspot.debugger.cdbg.*;
39 import sun.jvm.hotspot.debugger.cdbg.basic.BasicDebugEvent;
40 import sun.jvm.hotspot.utilities.*;
41 import sun.jvm.hotspot.utilities.memo.*;
42 import sun.jvm.hotspot.runtime.*;
43
44 /** <P> An implementation of the JVMDebugger interface which talks to
45 windbg and symbol table management is done in Java. </P>
46
47 <P> <B>NOTE</B> that since we have the notion of fetching "Java
48 primitive types" from the remote process (which might have
49 different sizes than we expect) we have a bootstrapping
50 problem. We need to know the sizes of these types before we can
51 fetch them. The current implementation solves this problem by
52 requiring that it be configured with these type sizes before they
53 can be fetched. The readJ(Type) routines here will throw a
54 RuntimeException if they are called before the debugger is
98 utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian()) {
99 public void checkAlignment(long address, long alignment) {
100 // Need to override default checkAlignment because we need to
101 // relax alignment constraints on Windows/x86
102 if ( (address % alignment != 0)
103 &&(alignment != 8 || address % 4 != 0)) {
104 throw new UnalignedAddressException(
105 "Trying to read at address: "
106 + addressValueToString(address)
107 + " with alignment: " + alignment,
108 address);
109 }
110 }
111 };
112
113 String cpu = PlatformInfo.getCPU();
114 if (cpu.equals("x86")) {
115 threadFactory = new WindbgX86ThreadFactory(this);
116 } else if (cpu.equals("amd64")) {
117 threadFactory = new WindbgAMD64ThreadFactory(this);
118 } else if (cpu.equals("aarch64")) {
119 threadFactory = new WindbgAARCH64ThreadFactory(this);
120 }
121
122 if (useCache) {
123 // Cache portion of the remote process's address space.
124 // Fetching data over the socket connection to dbx is slow.
125 // Might be faster if we were using a binary protocol to talk to
126 // dbx, but would have to test. For now, this cache works best
127 // if it covers the entire heap of the remote process. FIXME: at
128 // least should make this tunable from the outside, i.e., via
129 // the UI. This is a cache of 4096 4K pages, or 16 MB. The page
130 // size must be adjusted to be the hardware's page size.
131 // (FIXME: should pick this up from the debugger.)
132 initCache(4096, 4096);
133 }
134 // FIXME: add instantiation of thread factory
135
136 }
137
138 /** From the Debugger interface via JVMDebugger */
139 public boolean hasProcessList() throws DebuggerException {
|