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.remote;
26
27 import java.rmi.*;
28 import java.util.*;
29 import java.lang.reflect.*;
30
31 import sun.jvm.hotspot.debugger.*;
32 import sun.jvm.hotspot.debugger.cdbg.*;
33 import sun.jvm.hotspot.debugger.remote.sparc.*;
34 import sun.jvm.hotspot.debugger.remote.x86.*;
35 import sun.jvm.hotspot.debugger.remote.amd64.*;
36 import sun.jvm.hotspot.debugger.remote.ppc64.*;
37
38 /** An implementation of Debugger which wraps a
39 RemoteDebugger, providing remote debugging via RMI.
40 This implementation provides caching of the remote process's
41 address space on the local machine where the user interface is
42 running. */
43
44 public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
45 private RemoteDebugger remoteDebugger;
46 private RemoteThreadFactory threadFactory;
47 private boolean unalignedAccessesOkay = false;
48 private static final int cacheSize = 16 * 1024 * 1024; // 16 MB
49
50 public RemoteDebuggerClient(RemoteDebugger remoteDebugger) throws DebuggerException {
51 super();
52 try {
53 this.remoteDebugger = remoteDebugger;
54 machDesc = remoteDebugger.getMachineDescription();
55 utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian());
56 int cacheNumPages;
57 int cachePageSize;
58 String cpu = remoteDebugger.getCPU();
59 // page size. (FIXME: should pick this up from the remoteDebugger.)
60 if (cpu.equals("sparc")) {
61 threadFactory = new RemoteSPARCThreadFactory(this);
62 cachePageSize = 8192;
63 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
64 } else if (cpu.equals("x86")) {
65 threadFactory = new RemoteX86ThreadFactory(this);
66 cachePageSize = 4096;
67 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
68 unalignedAccessesOkay = true;
69 } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
70 threadFactory = new RemoteAMD64ThreadFactory(this);
71 cachePageSize = 4096;
72 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
73 unalignedAccessesOkay = true;
74 } else if (cpu.equals("ppc64")) {
75 threadFactory = new RemotePPC64ThreadFactory(this);
76 cachePageSize = 4096;
77 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
78 unalignedAccessesOkay = true;
79 } else {
80 try {
81 Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." +
82 cpu.toLowerCase() + ".Remote" + cpu.toUpperCase() +
83 "ThreadFactory");
84 Constructor[] ctf = tf.getConstructors();
|
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.remote;
26
27 import java.rmi.*;
28 import java.util.*;
29 import java.lang.reflect.*;
30
31 import sun.jvm.hotspot.debugger.*;
32 import sun.jvm.hotspot.debugger.cdbg.*;
33 import sun.jvm.hotspot.debugger.remote.x86.*;
34 import sun.jvm.hotspot.debugger.remote.amd64.*;
35 import sun.jvm.hotspot.debugger.remote.ppc64.*;
36
37 /** An implementation of Debugger which wraps a
38 RemoteDebugger, providing remote debugging via RMI.
39 This implementation provides caching of the remote process's
40 address space on the local machine where the user interface is
41 running. */
42
43 public class RemoteDebuggerClient extends DebuggerBase implements JVMDebugger {
44 private RemoteDebugger remoteDebugger;
45 private RemoteThreadFactory threadFactory;
46 private boolean unalignedAccessesOkay = false;
47 private static final int cacheSize = 16 * 1024 * 1024; // 16 MB
48
49 public RemoteDebuggerClient(RemoteDebugger remoteDebugger) throws DebuggerException {
50 super();
51 try {
52 this.remoteDebugger = remoteDebugger;
53 machDesc = remoteDebugger.getMachineDescription();
54 utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian());
55 int cacheNumPages;
56 int cachePageSize;
57 String cpu = remoteDebugger.getCPU();
58 // page size. (FIXME: should pick this up from the remoteDebugger.)
59 if (cpu.equals("x86")) {
60 threadFactory = new RemoteX86ThreadFactory(this);
61 cachePageSize = 4096;
62 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
63 unalignedAccessesOkay = true;
64 } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
65 threadFactory = new RemoteAMD64ThreadFactory(this);
66 cachePageSize = 4096;
67 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
68 unalignedAccessesOkay = true;
69 } else if (cpu.equals("ppc64")) {
70 threadFactory = new RemotePPC64ThreadFactory(this);
71 cachePageSize = 4096;
72 cacheNumPages = parseCacheNumPagesProperty(cacheSize / cachePageSize);
73 unalignedAccessesOkay = true;
74 } else {
75 try {
76 Class tf = Class.forName("sun.jvm.hotspot.debugger.remote." +
77 cpu.toLowerCase() + ".Remote" + cpu.toUpperCase() +
78 "ThreadFactory");
79 Constructor[] ctf = tf.getConstructors();
|