comparison agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java @ 3960:f08d439fab8c

7089790: integrate bsd-port changes Reviewed-by: kvn, twisti, jrose Contributed-by: Kurt Miller <kurt@intricatesoftware.com>, Greg Lewis <glewis@eyesbeyond.com>, Jung-uk Kim <jkim@freebsd.org>, Christos Zoulas <christos@zoulas.com>, Landon Fuller <landonf@plausible.coop>, The FreeBSD Foundation <board@freebsdfoundation.org>, Michael Franz <mvfranz@gmail.com>, Roger Hoover <rhoover@apple.com>, Alexander Strange <astrange@apple.com>
author never
date Sun, 25 Sep 2011 16:03:29 -0700
parents f6f3bb0ee072
children 78d2ae5ab35b
comparison
equal deleted inserted replaced
3959:eda6988c0d81 3960:f08d439fab8c
26 26
27 import java.io.PrintStream; 27 import java.io.PrintStream;
28 import java.net.*; 28 import java.net.*;
29 import java.rmi.*; 29 import java.rmi.*;
30 import sun.jvm.hotspot.debugger.*; 30 import sun.jvm.hotspot.debugger.*;
31 import sun.jvm.hotspot.debugger.bsd.*;
31 import sun.jvm.hotspot.debugger.proc.*; 32 import sun.jvm.hotspot.debugger.proc.*;
32 import sun.jvm.hotspot.debugger.remote.*; 33 import sun.jvm.hotspot.debugger.remote.*;
33 import sun.jvm.hotspot.debugger.windbg.*; 34 import sun.jvm.hotspot.debugger.windbg.*;
34 import sun.jvm.hotspot.debugger.linux.*; 35 import sun.jvm.hotspot.debugger.linux.*;
35 import sun.jvm.hotspot.memory.*; 36 import sun.jvm.hotspot.memory.*;
333 setupDebuggerSolaris(); 334 setupDebuggerSolaris();
334 } else if (os.equals("win32")) { 335 } else if (os.equals("win32")) {
335 setupDebuggerWin32(); 336 setupDebuggerWin32();
336 } else if (os.equals("linux")) { 337 } else if (os.equals("linux")) {
337 setupDebuggerLinux(); 338 setupDebuggerLinux();
339 } else if (os.equals("bsd")) {
340 setupDebuggerBsd();
338 } else { 341 } else {
339 // Add support for more operating systems here 342 // Add support for more operating systems here
340 throw new DebuggerException("Operating system " + os + " not yet supported"); 343 throw new DebuggerException("Operating system " + os + " not yet supported");
341 } 344 }
342 345
388 debugger, jvmLibNames); 391 debugger, jvmLibNames);
389 } else if (os.equals("linux")) { 392 } else if (os.equals("linux")) {
390 db = new HotSpotTypeDataBase(machDesc, 393 db = new HotSpotTypeDataBase(machDesc,
391 new LinuxVtblAccess(debugger, jvmLibNames), 394 new LinuxVtblAccess(debugger, jvmLibNames),
392 debugger, jvmLibNames); 395 debugger, jvmLibNames);
396 } else if (os.equals("bsd")) {
397 db = new HotSpotTypeDataBase(machDesc,
398 new BsdVtblAccess(debugger, jvmLibNames),
399 debugger, jvmLibNames);
393 } else { 400 } else {
394 throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); 401 throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)");
395 } 402 }
396 } 403 }
397 catch (NoSuchSymbolException e) { 404 catch (NoSuchSymbolException e) {
475 setupJVMLibNamesSolaris(); 482 setupJVMLibNamesSolaris();
476 } else if (os.equals("win32")) { 483 } else if (os.equals("win32")) {
477 setupJVMLibNamesWin32(); 484 setupJVMLibNamesWin32();
478 } else if (os.equals("linux")) { 485 } else if (os.equals("linux")) {
479 setupJVMLibNamesLinux(); 486 setupJVMLibNamesLinux();
487 } else if (os.equals("bsd")) {
488 setupJVMLibNamesBsd();
480 } else { 489 } else {
481 throw new RuntimeException("Unknown OS type"); 490 throw new RuntimeException("Unknown OS type");
482 } 491 }
483 492
484 cpu = debugger.getCPU(); 493 cpu = debugger.getCPU();
552 561
553 private void setupJVMLibNamesLinux() { 562 private void setupJVMLibNamesLinux() {
554 jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; 563 jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" };
555 } 564 }
556 565
566 //
567 // BSD
568 //
569
570 private void setupDebuggerBsd() {
571 setupJVMLibNamesBsd();
572
573 if (cpu.equals("x86")) {
574 machDesc = new MachineDescriptionIntelX86();
575 } else if (cpu.equals("amd64")) {
576 machDesc = new MachineDescriptionAMD64();
577 } else {
578 throw new DebuggerException("BSD only supported on x86/amd64");
579 }
580
581 BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer);
582 debugger = dbg;
583
584 attachDebugger();
585 }
586
587 private void setupJVMLibNamesBsd() {
588 jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" };
589 }
590
557 /** Convenience routine which should be called by per-platform 591 /** Convenience routine which should be called by per-platform
558 debugger setup. Should not be called when startupMode is 592 debugger setup. Should not be called when startupMode is
559 REMOTE_MODE. */ 593 REMOTE_MODE. */
560 private void attachDebugger() { 594 private void attachDebugger() {
561 if (startupMode == PROCESS_MODE) { 595 if (startupMode == PROCESS_MODE) {