9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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 #include <fcntl.h>
26 #include "precompiled.hpp"
27 #include "code/codeCache.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "gc/shared/collectedHeap.hpp"
30 #include "prims/whitebox.hpp"
31 #include "runtime/arguments.hpp"
32 #include "runtime/atomic.inline.hpp"
33 #include "runtime/frame.inline.hpp"
34 #include "runtime/init.hpp"
35 #include "runtime/os.hpp"
36 #include "runtime/thread.inline.hpp"
37 #include "runtime/vmThread.hpp"
38 #include "runtime/vm_operations.hpp"
39 #include "services/memTracker.hpp"
40 #include "utilities/debug.hpp"
41 #include "utilities/decoder.hpp"
42 #include "utilities/defaultStream.hpp"
43 #include "utilities/errorReporter.hpp"
44 #include "utilities/events.hpp"
45 #include "utilities/top.hpp"
46 #include "utilities/vmError.hpp"
47
48 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
494 if (should_report_bug(_id)) { // already printed the message.
495 // error message
496 if (_detail_msg) {
497 st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg);
498 } else if (_message) {
499 st->print_cr("# Error: %s", _message);
500 }
501 }
502
503 STEP(90, "(printing Java version string)")
504
505 // VM version
506 st->print_cr("#");
507 JDK_Version::current().to_string(buf, sizeof(buf));
508 const char* runtime_name = JDK_Version::runtime_name() != NULL ?
509 JDK_Version::runtime_name() : "";
510 const char* runtime_version = JDK_Version::runtime_version() != NULL ?
511 JDK_Version::runtime_version() : "";
512 st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version);
513 // This is the long version with some default settings added
514 st->print_cr("# Java VM: %s (%s, %s%s%s, %s, %s)",
515 Abstract_VM_Version::vm_name(),
516 Abstract_VM_Version::vm_release(),
517 Abstract_VM_Version::vm_info_string(),
518 TieredCompilation ? ", tiered" : "",
519 UseCompressedOops ? ", compressed oops" : "",
520 gc_mode(),
521 Abstract_VM_Version::vm_platform_string()
522 );
523
524 STEP(100, "(printing problematic frame)")
525
526 // Print current frame if we have a context (i.e. it's a crash)
527 if (_context) {
528 st->print_cr("# Problematic frame:");
529 st->print("# ");
530 frame fr = os::fetch_frame_from_context(_context);
531 fr.print_on_error(st, buf, sizeof(buf));
532 st->cr();
533 st->print_cr("#");
534 }
535
536 STEP(110, "(printing core file information)")
537 st->print("# ");
538 if (CreateCoredumpOnCrash) {
687 os::print_siginfo(st, _siginfo);
688 st->cr();
689 }
690
691 STEP(250, "(printing register info)")
692
693 // decode register contents if possible
694 if (_verbose && _context && Universe::is_fully_initialized()) {
695 os::print_register_info(st, _context);
696 st->cr();
697 }
698
699 STEP(260, "(printing registers, top of stack, instructions near pc)")
700
701 // registers, top of stack, instructions near pc
702 if (_verbose && _context) {
703 os::print_context(st, _context);
704 st->cr();
705 }
706
707 STEP(270, "(printing VM operation)" )
708
709 if (_verbose && _thread && _thread->is_VM_thread()) {
710 VMThread* t = (VMThread*)_thread;
711 VM_Operation* op = t->vm_operation();
712 if (op) {
713 op->print_on_error(st);
714 st->cr();
715 st->cr();
716 }
717 }
718
719 STEP(280, "(printing process)" )
720
721 if (_verbose) {
722 st->cr();
723 st->print_cr("--------------- P R O C E S S ---------------");
724 st->cr();
725 }
726
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
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 #include <fcntl.h>
26 #include "precompiled.hpp"
27 #include "code/codeCache.hpp"
28 #include "compiler/compileBroker.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "gc/shared/collectedHeap.hpp"
31 #include "prims/whitebox.hpp"
32 #include "runtime/arguments.hpp"
33 #include "runtime/atomic.inline.hpp"
34 #include "runtime/frame.inline.hpp"
35 #include "runtime/init.hpp"
36 #include "runtime/os.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "runtime/vmThread.hpp"
39 #include "runtime/vm_operations.hpp"
40 #include "services/memTracker.hpp"
41 #include "utilities/debug.hpp"
42 #include "utilities/decoder.hpp"
43 #include "utilities/defaultStream.hpp"
44 #include "utilities/errorReporter.hpp"
45 #include "utilities/events.hpp"
46 #include "utilities/top.hpp"
47 #include "utilities/vmError.hpp"
48
49 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
495 if (should_report_bug(_id)) { // already printed the message.
496 // error message
497 if (_detail_msg) {
498 st->print_cr("# %s: %s", _message ? _message : "Error", _detail_msg);
499 } else if (_message) {
500 st->print_cr("# Error: %s", _message);
501 }
502 }
503
504 STEP(90, "(printing Java version string)")
505
506 // VM version
507 st->print_cr("#");
508 JDK_Version::current().to_string(buf, sizeof(buf));
509 const char* runtime_name = JDK_Version::runtime_name() != NULL ?
510 JDK_Version::runtime_name() : "";
511 const char* runtime_version = JDK_Version::runtime_version() != NULL ?
512 JDK_Version::runtime_version() : "";
513 st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version);
514 // This is the long version with some default settings added
515 st->print_cr("# Java VM: %s (%s, %s%s%s%s%s, %s, %s)",
516 Abstract_VM_Version::vm_name(),
517 Abstract_VM_Version::vm_release(),
518 Abstract_VM_Version::vm_info_string(),
519 TieredCompilation ? ", tiered" : "",
520 #if INCLUDE_JVMCI
521 EnableJVMCI ? ", jvmci" : "",
522 UseJVMCICompiler ? ", jvmci compiler" : "",
523 #endif
524 UseCompressedOops ? ", compressed oops" : "",
525 gc_mode(),
526 Abstract_VM_Version::vm_platform_string()
527 );
528
529 STEP(100, "(printing problematic frame)")
530
531 // Print current frame if we have a context (i.e. it's a crash)
532 if (_context) {
533 st->print_cr("# Problematic frame:");
534 st->print("# ");
535 frame fr = os::fetch_frame_from_context(_context);
536 fr.print_on_error(st, buf, sizeof(buf));
537 st->cr();
538 st->print_cr("#");
539 }
540
541 STEP(110, "(printing core file information)")
542 st->print("# ");
543 if (CreateCoredumpOnCrash) {
692 os::print_siginfo(st, _siginfo);
693 st->cr();
694 }
695
696 STEP(250, "(printing register info)")
697
698 // decode register contents if possible
699 if (_verbose && _context && Universe::is_fully_initialized()) {
700 os::print_register_info(st, _context);
701 st->cr();
702 }
703
704 STEP(260, "(printing registers, top of stack, instructions near pc)")
705
706 // registers, top of stack, instructions near pc
707 if (_verbose && _context) {
708 os::print_context(st, _context);
709 st->cr();
710 }
711
712 STEP(265, "(printing code blob if possible)")
713
714 if (_verbose && _context) {
715 CodeBlob* cb = CodeCache::find_blob(_pc);
716 if (cb != NULL) {
717 if (Interpreter::contains(_pc)) {
718 // The interpreter CodeBlob is very large so try to print the codelet instead.
719 InterpreterCodelet* codelet = Interpreter::codelet_containing(_pc);
720 if (codelet != NULL) {
721 codelet->print_on(st);
722 Disassembler::decode(codelet->code_begin(), codelet->code_end(), st);
723 }
724 } else {
725 StubCodeDesc* desc = StubCodeDesc::desc_for(_pc);
726 if (desc != NULL) {
727 desc->print_on(st);
728 Disassembler::decode(desc->begin(), desc->end(), st);
729 } else {
730 Disassembler::decode(cb, st);
731 st->cr();
732 }
733 }
734 }
735 }
736
737 STEP(270, "(printing VM operation)" )
738
739 if (_verbose && _thread && _thread->is_VM_thread()) {
740 VMThread* t = (VMThread*)_thread;
741 VM_Operation* op = t->vm_operation();
742 if (op) {
743 op->print_on_error(st);
744 st->cr();
745 st->cr();
746 }
747 }
748
749 STEP(280, "(printing process)" )
750
751 if (_verbose) {
752 st->cr();
753 st->print_cr("--------------- P R O C E S S ---------------");
754 st->cr();
755 }
756
|