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.proc;
26
27 import java.io.*;
28 import java.net.*;
29 import java.util.*;
30 import java.lang.reflect.*;
31 import sun.jvm.hotspot.debugger.*;
32 import sun.jvm.hotspot.debugger.cdbg.*;
33 import sun.jvm.hotspot.debugger.proc.amd64.*;
34 import sun.jvm.hotspot.debugger.proc.sparc.*;
35 import sun.jvm.hotspot.debugger.proc.ppc64.*;
36 import sun.jvm.hotspot.debugger.proc.x86.*;
37 import sun.jvm.hotspot.debugger.ppc64.*;
38 import sun.jvm.hotspot.debugger.amd64.*;
39 import sun.jvm.hotspot.debugger.sparc.*;
40 import sun.jvm.hotspot.debugger.x86.*;
41 import sun.jvm.hotspot.utilities.*;
42
43 /** <P> An implementation of the JVMDebugger interface which sits on
44 * top of proc and relies on the SA's proc import module for
45 * communication with the debugger. </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
55 * configured with the Java primitive type sizes. </P>
56 */
57
58 public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
71 * purpose of supporting remote debugging. </P> */
72 public ProcDebuggerLocal(MachineDescription machDesc, boolean useCache) {
73 this.machDesc = machDesc;
74 int cacheNumPages;
75 int cachePageSize;
76
77 final String cpu = PlatformInfo.getCPU();
78 if (cpu.equals("sparc")) {
79 threadFactory = new ProcSPARCThreadFactory(this);
80 pcRegIndex = SPARCThreadContext.R_PC;
81 fpRegIndex = SPARCThreadContext.R_I6;
82 } else if (cpu.equals("x86")) {
83 threadFactory = new ProcX86ThreadFactory(this);
84 pcRegIndex = X86ThreadContext.EIP;
85 fpRegIndex = X86ThreadContext.EBP;
86 unalignedAccessesOkay = true;
87 } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
88 threadFactory = new ProcAMD64ThreadFactory(this);
89 pcRegIndex = AMD64ThreadContext.RIP;
90 fpRegIndex = AMD64ThreadContext.RBP;
91 } else if (cpu.equals("ppc64")) {
92 threadFactory = new ProcPPC64ThreadFactory(this);
93 pcRegIndex = PPC64ThreadContext.PC;
94 fpRegIndex = PPC64ThreadContext.SP;
95 } else {
96 try {
97 Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." +
98 cpu.toLowerCase() + ".Proc" + cpu.toUpperCase() +
99 "ThreadFactory");
100 Constructor[] ctfc = tfc.getConstructors();
101 threadFactory = (ProcThreadFactory)ctfc[0].newInstance(this);
102 } catch (Exception e) {
103 throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported");
104 // Note: pcRegIndex and fpRegIndex do not appear to be referenced
105 }
106 }
107 if (useCache) {
108 // Cache portion of the remote process's address space.
109 // For now, this cache works best if it covers the entire
110 // heap of the remote process. FIXME: at least should make this
|
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.proc;
26
27 import java.io.*;
28 import java.net.*;
29 import java.util.*;
30 import java.lang.reflect.*;
31 import sun.jvm.hotspot.debugger.*;
32 import sun.jvm.hotspot.debugger.cdbg.*;
33 import sun.jvm.hotspot.debugger.proc.amd64.*;
34 import sun.jvm.hotspot.debugger.proc.aarch64.*;
35 import sun.jvm.hotspot.debugger.proc.sparc.*;
36 import sun.jvm.hotspot.debugger.proc.ppc64.*;
37 import sun.jvm.hotspot.debugger.proc.x86.*;
38 import sun.jvm.hotspot.debugger.ppc64.*;
39 import sun.jvm.hotspot.debugger.amd64.*;
40 import sun.jvm.hotspot.debugger.aarch64.*;
41 import sun.jvm.hotspot.debugger.sparc.*;
42 import sun.jvm.hotspot.debugger.x86.*;
43 import sun.jvm.hotspot.utilities.*;
44
45 /** <P> An implementation of the JVMDebugger interface which sits on
46 * top of proc and relies on the SA's proc import module for
47 * communication with the debugger. </P>
48 *
49 * <P> <B>NOTE</B> that since we have the notion of fetching "Java
50 * primitive types" from the remote process (which might have
51 * different sizes than we expect) we have a bootstrapping
52 * problem. We need to know the sizes of these types before we can
53 * fetch them. The current implementation solves this problem by
54 * requiring that it be configured with these type sizes before they
55 * can be fetched. The readJ(Type) routines here will throw a
56 * RuntimeException if they are called before the debugger is
57 * configured with the Java primitive type sizes. </P>
58 */
59
60 public class ProcDebuggerLocal extends DebuggerBase implements ProcDebugger {
73 * purpose of supporting remote debugging. </P> */
74 public ProcDebuggerLocal(MachineDescription machDesc, boolean useCache) {
75 this.machDesc = machDesc;
76 int cacheNumPages;
77 int cachePageSize;
78
79 final String cpu = PlatformInfo.getCPU();
80 if (cpu.equals("sparc")) {
81 threadFactory = new ProcSPARCThreadFactory(this);
82 pcRegIndex = SPARCThreadContext.R_PC;
83 fpRegIndex = SPARCThreadContext.R_I6;
84 } else if (cpu.equals("x86")) {
85 threadFactory = new ProcX86ThreadFactory(this);
86 pcRegIndex = X86ThreadContext.EIP;
87 fpRegIndex = X86ThreadContext.EBP;
88 unalignedAccessesOkay = true;
89 } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
90 threadFactory = new ProcAMD64ThreadFactory(this);
91 pcRegIndex = AMD64ThreadContext.RIP;
92 fpRegIndex = AMD64ThreadContext.RBP;
93 } else if (cpu.equals("aarch64")) {
94 threadFactory = new ProcAARCH64ThreadFactory(this);
95 pcRegIndex = AARCH64ThreadContext.PC;
96 fpRegIndex = AARCH64ThreadContext.FP;
97 } else if (cpu.equals("ppc64")) {
98 threadFactory = new ProcPPC64ThreadFactory(this);
99 pcRegIndex = PPC64ThreadContext.PC;
100 fpRegIndex = PPC64ThreadContext.SP;
101 } else {
102 try {
103 Class tfc = Class.forName("sun.jvm.hotspot.debugger.proc." +
104 cpu.toLowerCase() + ".Proc" + cpu.toUpperCase() +
105 "ThreadFactory");
106 Constructor[] ctfc = tfc.getConstructors();
107 threadFactory = (ProcThreadFactory)ctfc[0].newInstance(this);
108 } catch (Exception e) {
109 throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported");
110 // Note: pcRegIndex and fpRegIndex do not appear to be referenced
111 }
112 }
113 if (useCache) {
114 // Cache portion of the remote process's address space.
115 // For now, this cache works best if it covers the entire
116 // heap of the remote process. FIXME: at least should make this
|