< prev index next >

src/hotspot/share/runtime/frame.cpp

Print this page

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


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

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

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