Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java @ 8750:39432a1cefdd
8003348: SA can not read core file on OS
Summary: Macosx uses Mach-O file format for binary files, not ELF format. Currently SA works on core files on other platforms, t his change enables SA work on core file generated on Darwin.
Reviewed-by: sla, sspitsyn
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Thu, 14 Mar 2013 00:33:08 -0700 |
parents | 5a98bf7d847b |
children | f6a055fcf47d |
comparison
equal
deleted
inserted
replaced
8719:c8b31b461e1a | 8750:39432a1cefdd |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2013, 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. |
309 setupDebuggerWin32(); | 309 setupDebuggerWin32(); |
310 } else if (os.equals("linux")) { | 310 } else if (os.equals("linux")) { |
311 setupDebuggerLinux(); | 311 setupDebuggerLinux(); |
312 } else if (os.equals("bsd")) { | 312 } else if (os.equals("bsd")) { |
313 setupDebuggerBsd(); | 313 setupDebuggerBsd(); |
314 } else if (os.equals("darwin")) { | |
315 setupDebuggerDarwin(); | |
314 } else { | 316 } else { |
315 // Add support for more operating systems here | 317 // Add support for more operating systems here |
316 throw new DebuggerException("Operating system " + os + " not yet supported"); | 318 throw new DebuggerException("Operating system " + os + " not yet supported"); |
317 } | 319 } |
318 | 320 |
368 debugger, jvmLibNames); | 370 debugger, jvmLibNames); |
369 } else if (os.equals("bsd")) { | 371 } else if (os.equals("bsd")) { |
370 db = new HotSpotTypeDataBase(machDesc, | 372 db = new HotSpotTypeDataBase(machDesc, |
371 new BsdVtblAccess(debugger, jvmLibNames), | 373 new BsdVtblAccess(debugger, jvmLibNames), |
372 debugger, jvmLibNames); | 374 debugger, jvmLibNames); |
375 } else if (os.equals("darwin")) { | |
376 db = new HotSpotTypeDataBase(machDesc, | |
377 new BsdVtblAccess(debugger, jvmLibNames), | |
378 debugger, jvmLibNames); | |
373 } else { | 379 } else { |
374 throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); | 380 throw new DebuggerException("OS \"" + os + "\" not yet supported (no VtblAccess yet)"); |
375 } | 381 } |
376 } | 382 } |
377 catch (NoSuchSymbolException e) { | 383 catch (NoSuchSymbolException e) { |
457 setupJVMLibNamesWin32(); | 463 setupJVMLibNamesWin32(); |
458 } else if (os.equals("linux")) { | 464 } else if (os.equals("linux")) { |
459 setupJVMLibNamesLinux(); | 465 setupJVMLibNamesLinux(); |
460 } else if (os.equals("bsd")) { | 466 } else if (os.equals("bsd")) { |
461 setupJVMLibNamesBsd(); | 467 setupJVMLibNamesBsd(); |
468 } else if (os.equals("darwin")) { | |
469 setupJVMLibNamesDarwin(); | |
462 } else { | 470 } else { |
463 throw new RuntimeException("Unknown OS type"); | 471 throw new RuntimeException("Unknown OS type"); |
464 } | 472 } |
465 | 473 |
466 cpu = debugger.getCPU(); | 474 cpu = debugger.getCPU(); |
565 | 573 |
566 private void setupJVMLibNamesBsd() { | 574 private void setupJVMLibNamesBsd() { |
567 jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; | 575 jvmLibNames = new String[] { "libjvm.so", "libjvm_g.so" }; |
568 } | 576 } |
569 | 577 |
578 // | |
579 // Darwin | |
580 // | |
581 | |
582 private void setupDebuggerDarwin() { | |
583 setupJVMLibNamesDarwin(); | |
584 | |
585 if (cpu.equals("amd64") || cpu.equals("x86_64")) { | |
586 machDesc = new MachineDescriptionAMD64(); | |
587 } else { | |
588 throw new DebuggerException("Darwin only supported on x86_64. Current arch: " + cpu); | |
589 } | |
590 | |
591 BsdDebuggerLocal dbg = new BsdDebuggerLocal(machDesc, !isServer); | |
592 debugger = dbg; | |
593 | |
594 attachDebugger(); | |
595 } | |
596 | |
597 private void setupJVMLibNamesDarwin() { | |
598 jvmLibNames = new String[] { "libjvm.dylib", "libjvm_g.dylib" }; | |
599 } | |
600 | |
570 /** Convenience routine which should be called by per-platform | 601 /** Convenience routine which should be called by per-platform |
571 debugger setup. Should not be called when startupMode is | 602 debugger setup. Should not be called when startupMode is |
572 REMOTE_MODE. */ | 603 REMOTE_MODE. */ |
573 private void attachDebugger() { | 604 private void attachDebugger() { |
574 if (startupMode == PROCESS_MODE) { | 605 if (startupMode == PROCESS_MODE) { |