Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java @ 3945:8ed53447f690
Merge
author | iveresov |
---|---|
date | Thu, 15 Sep 2011 12:44:09 -0700 |
parents | f6f3bb0ee072 |
children | f08d439fab8c |
comparison
equal
deleted
inserted
replaced
3929:f94227b6117b | 3945:8ed53447f690 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
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.dbx.*; | |
32 import sun.jvm.hotspot.debugger.proc.*; | 31 import sun.jvm.hotspot.debugger.proc.*; |
33 import sun.jvm.hotspot.debugger.remote.*; | 32 import sun.jvm.hotspot.debugger.remote.*; |
34 import sun.jvm.hotspot.debugger.win32.*; | |
35 import sun.jvm.hotspot.debugger.windbg.*; | 33 import sun.jvm.hotspot.debugger.windbg.*; |
36 import sun.jvm.hotspot.debugger.linux.*; | 34 import sun.jvm.hotspot.debugger.linux.*; |
37 import sun.jvm.hotspot.memory.*; | 35 import sun.jvm.hotspot.memory.*; |
38 import sun.jvm.hotspot.oops.*; | 36 import sun.jvm.hotspot.oops.*; |
39 import sun.jvm.hotspot.runtime.*; | 37 import sun.jvm.hotspot.runtime.*; |
434 // Solaris | 432 // Solaris |
435 // | 433 // |
436 | 434 |
437 private void setupDebuggerSolaris() { | 435 private void setupDebuggerSolaris() { |
438 setupJVMLibNamesSolaris(); | 436 setupJVMLibNamesSolaris(); |
439 if(System.getProperty("sun.jvm.hotspot.debugger.useProcDebugger") != null) { | 437 ProcDebuggerLocal dbg = new ProcDebuggerLocal(null, true); |
440 ProcDebuggerLocal dbg = new ProcDebuggerLocal(null, true); | 438 debugger = dbg; |
441 debugger = dbg; | 439 attachDebugger(); |
442 attachDebugger(); | 440 |
443 | 441 // Set up CPU-dependent stuff |
444 // Set up CPU-dependent stuff | 442 if (cpu.equals("x86")) { |
445 if (cpu.equals("x86")) { | 443 machDesc = new MachineDescriptionIntelX86(); |
446 machDesc = new MachineDescriptionIntelX86(); | 444 } else if (cpu.equals("sparc")) { |
447 } else if (cpu.equals("sparc")) { | 445 int addressSize = dbg.getRemoteProcessAddressSize(); |
448 int addressSize = dbg.getRemoteProcessAddressSize(); | 446 if (addressSize == -1) { |
449 if (addressSize == -1) { | 447 throw new DebuggerException("Error occurred while trying to determine the remote process's " + |
450 throw new DebuggerException("Error occurred while trying to determine the remote process's " + | 448 "address size"); |
451 "address size"); | 449 } |
452 } | 450 |
453 | 451 if (addressSize == 32) { |
454 if (addressSize == 32) { | 452 machDesc = new MachineDescriptionSPARC32Bit(); |
455 machDesc = new MachineDescriptionSPARC32Bit(); | 453 } else if (addressSize == 64) { |
456 } else if (addressSize == 64) { | 454 machDesc = new MachineDescriptionSPARC64Bit(); |
457 machDesc = new MachineDescriptionSPARC64Bit(); | |
458 } else { | |
459 throw new DebuggerException("Address size " + addressSize + " is not supported on SPARC"); | |
460 } | |
461 } else if (cpu.equals("amd64")) { | |
462 machDesc = new MachineDescriptionAMD64(); | |
463 } else { | 455 } else { |
464 throw new DebuggerException("Solaris only supported on sparc/sparcv9/x86/amd64"); | 456 throw new DebuggerException("Address size " + addressSize + " is not supported on SPARC"); |
465 } | 457 } |
466 | 458 } else if (cpu.equals("amd64")) { |
467 dbg.setMachineDescription(machDesc); | 459 machDesc = new MachineDescriptionAMD64(); |
468 return; | 460 } else { |
469 | 461 throw new DebuggerException("Solaris only supported on sparc/sparcv9/x86/amd64"); |
470 } else { | 462 } |
471 String dbxPathName; | 463 |
472 String dbxPathPrefix; | 464 dbg.setMachineDescription(machDesc); |
473 String dbxSvcAgentDSOPathName; | 465 return; |
474 String dbxSvcAgentDSOPathPrefix; | |
475 String[] dbxSvcAgentDSOPathNames = null; | |
476 | |
477 // use path names/prefixes specified on command | |
478 dbxPathName = System.getProperty("dbxPathName"); | |
479 if (dbxPathName == null) { | |
480 dbxPathPrefix = System.getProperty("dbxPathPrefix"); | |
481 if (dbxPathPrefix == null) { | |
482 dbxPathPrefix = defaultDbxPathPrefix; | |
483 } | |
484 dbxPathName = dbxPathPrefix + fileSep + os + fileSep + cpu + fileSep + "bin" + fileSep + "dbx"; | |
485 } | |
486 | |
487 dbxSvcAgentDSOPathName = System.getProperty("dbxSvcAgentDSOPathName"); | |
488 if (dbxSvcAgentDSOPathName != null) { | |
489 dbxSvcAgentDSOPathNames = new String[] { dbxSvcAgentDSOPathName } ; | |
490 } else { | |
491 dbxSvcAgentDSOPathPrefix = System.getProperty("dbxSvcAgentDSOPathPrefix"); | |
492 if (dbxSvcAgentDSOPathPrefix == null) { | |
493 dbxSvcAgentDSOPathPrefix = defaultDbxSvcAgentDSOPathPrefix; | |
494 } | |
495 if (cpu.equals("sparc")) { | |
496 dbxSvcAgentDSOPathNames = new String[] { | |
497 // FIXME: bad hack for SPARC v9. This is necessary because | |
498 // there are two dbx executables on SPARC, one for v8 and one | |
499 // for v9, and it isn't obvious how to tell the two apart | |
500 // using the dbx command line. See | |
501 // DbxDebuggerLocal.importDbxModule(). | |
502 dbxSvcAgentDSOPathPrefix + fileSep + os + fileSep + cpu + "v9" + fileSep + "lib" + | |
503 fileSep + "libsvc_agent_dbx.so", | |
504 dbxSvcAgentDSOPathPrefix + fileSep + os + fileSep + cpu + fileSep + "lib" + | |
505 fileSep + "libsvc_agent_dbx.so", | |
506 }; | |
507 } else { | |
508 dbxSvcAgentDSOPathNames = new String[] { | |
509 dbxSvcAgentDSOPathPrefix + fileSep + os + fileSep + cpu + fileSep + "lib" + | |
510 fileSep + "libsvc_agent_dbx.so" | |
511 }; | |
512 } | |
513 } | |
514 | |
515 // Note we do not use a cache for the local debugger in server | |
516 // mode; it's taken care of on the client side | |
517 DbxDebuggerLocal dbg = new DbxDebuggerLocal(null, dbxPathName, dbxSvcAgentDSOPathNames, !isServer); | |
518 debugger = dbg; | |
519 | |
520 attachDebugger(); | |
521 | |
522 // Set up CPU-dependent stuff | |
523 if (cpu.equals("x86")) { | |
524 machDesc = new MachineDescriptionIntelX86(); | |
525 } else if (cpu.equals("sparc")) { | |
526 int addressSize = dbg.getRemoteProcessAddressSize(); | |
527 if (addressSize == -1) { | |
528 throw new DebuggerException("Error occurred while trying to determine the remote process's " + | |
529 "address size. It's possible that the Serviceability Agent's dbx module failed to " + | |
530 "initialize. Examine the standard output and standard error streams from the dbx " + | |
531 "process for more information."); | |
532 } | |
533 | |
534 if (addressSize == 32) { | |
535 machDesc = new MachineDescriptionSPARC32Bit(); | |
536 } else if (addressSize == 64) { | |
537 machDesc = new MachineDescriptionSPARC64Bit(); | |
538 } else { | |
539 throw new DebuggerException("Address size " + addressSize + " is not supported on SPARC"); | |
540 } | |
541 } | |
542 | |
543 dbg.setMachineDescription(machDesc); | |
544 | |
545 } | |
546 } | 466 } |
547 | 467 |
548 private void connectRemoteDebugger() throws DebuggerException { | 468 private void connectRemoteDebugger() throws DebuggerException { |
549 RemoteDebugger remote = | 469 RemoteDebugger remote = |
550 (RemoteDebugger) RMIHelper.lookup(debugServerID); | 470 (RemoteDebugger) RMIHelper.lookup(debugServerID); |
587 | 507 |
588 // Note we do not use a cache for the local debugger in server | 508 // Note we do not use a cache for the local debugger in server |
589 // mode; it will be taken care of on the client side (once remote | 509 // mode; it will be taken care of on the client side (once remote |
590 // debugging is implemented). | 510 // debugging is implemented). |
591 | 511 |
592 if (System.getProperty("sun.jvm.hotspot.debugger.useWindbgDebugger") != null) { | 512 debugger = new WindbgDebuggerLocal(machDesc, !isServer); |
593 debugger = new WindbgDebuggerLocal(machDesc, !isServer); | |
594 } else { | |
595 debugger = new Win32DebuggerLocal(machDesc, !isServer); | |
596 } | |
597 | 513 |
598 attachDebugger(); | 514 attachDebugger(); |
599 | 515 |
600 // FIXME: add support for server mode | 516 // FIXME: add support for server mode |
601 } | 517 } |