< prev index next >

src/hotspot/share/runtime/frame.cpp

Print this page

 639     int len = (int)strlen(os::file_separator());
 640     while ((p2 = strstr(p1, os::file_separator())) != nullptr) p1 = p2 + len;
 641     st->print("  [%s+0x%x]", p1, offset);
 642   } else {
 643     st->print("  " PTR_FORMAT, p2i(pc));
 644   }
 645 
 646   found = os::dll_address_to_function_name(pc, buf, buflen, &offset);
 647   if (found) {
 648     st->print("  %s+0x%x", buf, offset);
 649   }
 650 }
 651 
 652 // frame::print_on_error() is called by fatal error handler. Notice that we may
 653 // crash inside this function if stack frame is corrupted. The fatal error
 654 // handler can catch and handle the crash. Here we assume the frame is valid.
 655 //
 656 // First letter indicates type of the frame:
 657 //    J: Java frame (compiled)
 658 //    j: Java frame (interpreted)


 659 //    V: VM frame (C/C++)
 660 //    v: Other frames running VM generated code (e.g. stubs, adapters, etc.)
 661 //    C: C/C++ frame
 662 //
 663 // We don't need detailed frame type as that in frame::print_name(). "C"
 664 // suggests the problem is in user lib; everything else is likely a VM bug.
 665 
 666 void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const {
 667   if (_cb != nullptr) {
 668     if (Interpreter::contains(pc())) {
 669       Method* m = this->interpreter_frame_method();
 670       if (m != nullptr) {
 671         m->name_and_sig_as_C_string(buf, buflen);
 672         st->print("j  %s", buf);
 673         st->print("+%d", this->interpreter_frame_bci());
 674         ModuleEntry* module = m->method_holder()->module();
 675         if (module->is_named()) {
 676           module->name()->as_C_string(buf, buflen);
 677           st->print(" %s", buf);
 678           if (module->version() != nullptr) {
 679             module->version()->as_C_string(buf, buflen);
 680             st->print("@%s", buf);
 681           }
 682         }
 683       } else {
 684         st->print("j  " PTR_FORMAT, p2i(pc()));
 685       }
 686     } else if (StubRoutines::contains(pc())) {
 687       StubCodeDesc* desc = StubCodeDesc::desc_for(pc());
 688       if (desc != nullptr) {
 689         st->print("v  ~StubRoutines::%s " PTR_FORMAT, desc->name(), p2i(pc()));
 690       } else {
 691         st->print("v  ~StubRoutines::" PTR_FORMAT, p2i(pc()));
 692       }
 693     } else if (_cb->is_buffer_blob()) {
 694       st->print("v  ~BufferBlob::%s " PTR_FORMAT, ((BufferBlob *)_cb)->name(), p2i(pc()));
 695     } else if (_cb->is_nmethod()) {
 696       nmethod* nm = _cb->as_nmethod();
 697       Method* m = nm->method();
 698       if (m != nullptr) {
 699         st->print("J %d%s", nm->compile_id(), (nm->is_osr_method() ? "%" : ""));

 700         st->print(" %s", nm->compiler_name());
 701         m->name_and_sig_as_C_string(buf, buflen);
 702         st->print(" %s", buf);
 703         ModuleEntry* module = m->method_holder()->module();
 704         if (module->is_named()) {
 705           module->name()->as_C_string(buf, buflen);
 706           st->print(" %s", buf);
 707           if (module->version() != nullptr) {
 708             module->version()->as_C_string(buf, buflen);
 709             st->print("@%s", buf);
 710           }
 711         }
 712         st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]",
 713                   m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin());
 714 #if INCLUDE_JVMCI
 715         const char* jvmciName = nm->jvmci_name();
 716         if (jvmciName != nullptr) {
 717           st->print(" (%s)", jvmciName);
 718         }
 719 #endif

 639     int len = (int)strlen(os::file_separator());
 640     while ((p2 = strstr(p1, os::file_separator())) != nullptr) p1 = p2 + len;
 641     st->print("  [%s+0x%x]", p1, offset);
 642   } else {
 643     st->print("  " PTR_FORMAT, p2i(pc));
 644   }
 645 
 646   found = os::dll_address_to_function_name(pc, buf, buflen, &offset);
 647   if (found) {
 648     st->print("  %s+0x%x", buf, offset);
 649   }
 650 }
 651 
 652 // frame::print_on_error() is called by fatal error handler. Notice that we may
 653 // crash inside this function if stack frame is corrupted. The fatal error
 654 // handler can catch and handle the crash. Here we assume the frame is valid.
 655 //
 656 // First letter indicates type of the frame:
 657 //    J: Java frame (compiled)
 658 //    j: Java frame (interpreted)
 659 //    A: Java frame (AOT compiled and loaded after class initialization)
 660 //    P: Java frame (AOT compiled and preloaded before class initialization)
 661 //    V: VM frame (C/C++)
 662 //    v: Other frames running VM generated code (e.g. stubs, adapters, etc.)
 663 //    C: C/C++ frame
 664 //
 665 // We don't need detailed frame type as that in frame::print_name(). "C"
 666 // suggests the problem is in user lib; everything else is likely a VM bug.
 667 
 668 void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const {
 669   if (_cb != nullptr) {
 670     if (Interpreter::contains(pc())) {
 671       Method* m = this->interpreter_frame_method();
 672       if (m != nullptr) {
 673         m->name_and_sig_as_C_string(buf, buflen);
 674         st->print("j  %s", buf);
 675         st->print("+%d", this->interpreter_frame_bci());
 676         ModuleEntry* module = m->method_holder()->module();
 677         if (module->is_named()) {
 678           module->name()->as_C_string(buf, buflen);
 679           st->print(" %s", buf);
 680           if (module->version() != nullptr) {
 681             module->version()->as_C_string(buf, buflen);
 682             st->print("@%s", buf);
 683           }
 684         }
 685       } else {
 686         st->print("j  " PTR_FORMAT, p2i(pc()));
 687       }
 688     } else if (StubRoutines::contains(pc())) {
 689       StubCodeDesc* desc = StubCodeDesc::desc_for(pc());
 690       if (desc != nullptr) {
 691         st->print("v  ~StubRoutines::%s " PTR_FORMAT, desc->name(), p2i(pc()));
 692       } else {
 693         st->print("v  ~StubRoutines::" PTR_FORMAT, p2i(pc()));
 694       }
 695     } else if (_cb->is_buffer_blob()) {
 696       st->print("v  ~BufferBlob::%s " PTR_FORMAT, ((BufferBlob *)_cb)->name(), p2i(pc()));
 697     } else if (_cb->is_nmethod()) {
 698       nmethod* nm = _cb->as_nmethod();
 699       Method* m = nm->method();
 700       if (m != nullptr) {
 701         st->print("%s", (nm->preloaded() ? "P" : (nm->is_aot() ? "A" : "J")));
 702         st->print(" %d%s", nm->compile_id(), (nm->is_osr_method() ? "%" : ""));
 703         st->print(" %s", nm->compiler_name());
 704         m->name_and_sig_as_C_string(buf, buflen);
 705         st->print(" %s", buf);
 706         ModuleEntry* module = m->method_holder()->module();
 707         if (module->is_named()) {
 708           module->name()->as_C_string(buf, buflen);
 709           st->print(" %s", buf);
 710           if (module->version() != nullptr) {
 711             module->version()->as_C_string(buf, buflen);
 712             st->print("@%s", buf);
 713           }
 714         }
 715         st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]",
 716                   m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin());
 717 #if INCLUDE_JVMCI
 718         const char* jvmciName = nm->jvmci_name();
 719         if (jvmciName != nullptr) {
 720           st->print(" (%s)", jvmciName);
 721         }
 722 #endif
< prev index next >