Here are the proposed changes to shared parts of the agent code:
diff -r e6e7d76b2bd3 agent/make/Makefile --- a/agent/make/Makefile Tue May 24 15:28:35 2011 -0700 +++ b/agent/make/Makefile Mon Jul 25 17:04:06 2011 -0700 @@ -52,6 +52,9 @@ sun.jvm.hotspot.compiler \ sun.jvm.hotspot.debugger \ sun.jvm.hotspot.debugger.amd64 \ +sun.jvm.hotspot.debugger.bsd \ +sun.jvm.hotspot.debugger.bsd.amd64 \ +sun.jvm.hotspot.debugger.bsd.x86 \ sun.jvm.hotspot.debugger.cdbg \ sun.jvm.hotspot.debugger.cdbg.basic \ sun.jvm.hotspot.debugger.cdbg.basic.amd64 \ @@ -94,6 +97,9 @@ sun.jvm.hotspot.oops \ sun.jvm.hotspot.runtime \ sun.jvm.hotspot.runtime.amd64 \ +sun.jvm.hotspot.runtime.bsd \ +sun.jvm.hotspot.runtime.bsd_amd64 \ +sun.jvm.hotspot.runtime.bsd_x86 \ sun.jvm.hotspot.runtime.ia64 \ sun.jvm.hotspot.runtime.linux \ sun.jvm.hotspot.runtime.linux_amd64 \ @@ -143,6 +149,8 @@ sun/jvm/hotspot/compiler/*.java \ sun/jvm/hotspot/debugger/*.java \ sun/jvm/hotspot/debugger/amd64/*.java \ +sun/jvm/hotspot/debugger/bsd/*.java \ +sun/jvm/hotspot/debugger/bsd/x86/*.java \ sun/jvm/hotspot/debugger/cdbg/*.java \ sun/jvm/hotspot/debugger/cdbg/basic/*.java \ sun/jvm/hotspot/debugger/cdbg/basic/amd64/*.java \ diff -r e6e7d76b2bd3 agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java --- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue May 24 15:28:35 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Mon Jul 25 17:04:06 2011 -0700 @@ -28,6 +28,7 @@ import java.net.*; import java.rmi.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.dbx.*; import sun.jvm.hotspot.debugger.proc.*; import sun.jvm.hotspot.debugger.remote.*; @@ -337,6 +338,8 @@ setupDebuggerWin32(); } else if (os.equals("linux")) { setupDebuggerLinux(); + } else if (os.equals("bsd")) { + setupDebuggerBsd(); } else { // Add support for more operating systems here throw new DebuggerException("Operating system " + os + " not yet supported"); @@ -392,6 +395,10 @@ db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), debugger, jvmLibNames); + } else if (os.equals("bsd")) { + db = new HotSpotTypeDataBase(machDesc, + new BsdVtblAccess(debugger, jvmLibNames), + debugger, jvmLibNames); } else { throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); } @@ -557,6 +564,8 @@ setupJVMLibNamesWin32(); } else if (os.equals("linux")) { setupJVMLibNamesLinux(); + } else if (os.equals("bsd")) { + setupJVMLibNamesBsd(); } else { throw new RuntimeException("Unknown OS type"); } @@ -638,6 +647,31 @@ jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; } + // + // BSD + // + + private void setupDebuggerBsd() { + setupJVMLibNamesBsd(); + + if (cpu.equals("x86")) { + machDesc = new MachineDescriptionIntelX86(); + } else if (cpu.equals("amd64")) { + machDesc = new MachineDescriptionAMD64(); + } else { + throw new DebuggerException("BSD only supported on x86/amd64"); + } + + BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer); + debugger = dbg; + + attachDebugger(); + } + + private void setupJVMLibNamesBsd() { + jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; + } + /** Convenience routine which should be called by per-platform debugger setup. Should not be called when startupMode is REMOTE_MODE. */ diff -r e6e7d76b2bd3 agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java --- a/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Tue May 24 15:28:35 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/bugspot/BugSpotAgent.java Mon Jul 25 17:04:06 2011 -0700 @@ -29,6 +29,7 @@ import java.rmi.*; import sun.jvm.hotspot.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.dbx.*; import sun.jvm.hotspot.debugger.proc.*; import sun.jvm.hotspot.debugger.cdbg.*; @@ -516,6 +517,8 @@ setupDebuggerWin32(); } else if (os.equals("linux")) { setupDebuggerLinux(); + } else if (os.equals("bsd")) { + setupDebuggerBsd(); } else { // Add support for more operating systems here throw new DebuggerException("Operating system " + os + " not yet supported"); @@ -567,6 +570,9 @@ } else if (os.equals("linux")) { db = new HotSpotTypeDataBase(machDesc, new LinuxVtblAccess(debugger, jvmLibNames), debugger, jvmLibNames); + } else if (os.equals("bsd")) { + db = new HotSpotTypeDataBase(machDesc, new BsdVtblAccess(debugger, jvmLibNames), + debugger, jvmLibNames); } else { throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess implemented yet)"); } @@ -739,6 +745,8 @@ setupJVMLibNamesWin32(); } else if (os.equals("linux")) { setupJVMLibNamesLinux(); + } else if (os.equals("bsd")) { + setupJVMLibNamesBsd(); } else { throw new RuntimeException("Unknown OS type"); } @@ -822,6 +830,34 @@ setupJVMLibNamesSolaris(); } + // + // BSD + // + + private void setupDebuggerBsd() { + setupJVMLibNamesBsd(); + + if (cpu.equals("x86")) { + machDesc = new MachineDescriptionIntelX86(); + } else if (cpu.equals("amd64")) { + machDesc = new MachineDescriptionAMD64(); + } else { + throw new DebuggerException("Bsd only supported on x86/amd64"); + } + + // Note we do not use a cache for the local debugger in server + // mode; it will be taken care of on the client side (once remote + // debugging is implemented). + + debugger = new BsdDebuggerLocal(machDesc, !isServer); + attachDebugger(); + } + + private void setupJVMLibNamesBsd() { + // same as solaris + setupJVMLibNamesSolaris(); + } + /** Convenience routine which should be called by per-platform debugger setup. Should not be called when startupMode is REMOTE_MODE. */ diff -r e6e7d76b2bd3 agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Tue May 24 15:28:35 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java Mon Jul 25 17:04:06 2011 -0700 @@ -37,6 +37,8 @@ import sun.jvm.hotspot.runtime.linux_ia64.LinuxIA64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess; import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess; +import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess; +import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess; import sun.jvm.hotspot.utilities.*; public class Threads { @@ -90,7 +92,12 @@ } else if (cpu.equals("sparc")) { access = new LinuxSPARCJavaThreadPDAccess(); } - + } else if (os.equals("bsd")) { + if (cpu.equals("x86")) { + access = new BsdX86JavaThreadPDAccess(); + } else if (cpu.equals("amd64")) { + access = new BsdAMD64JavaThreadPDAccess(); + } } if (access == null) { diff -r e6e7d76b2bd3 agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Tue May 24 15:28:35 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java Mon Jul 25 17:04:06 2011 -0700 @@ -37,6 +37,14 @@ return "solaris"; } else if (os.equals("Linux")) { return "linux"; + } else if (os.equals("FreeBSD")) { + return "bsd"; + } else if (os.equals("NetBSD")) { + return "bsd"; + } else if (os.equals("OpenBSD")) { + return "bsd"; + } else if (os.equals("Darwin")) { + return "bsd"; } else if (os.startsWith("Windows")) { return "win32"; } else {
Overview
Content Tools
ThemeBuilder