src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/frame.cpp

Print this page




 627 
 628   // function name - os::dll_address_to_function_name() may return confusing
 629   // names if pc is within jvm.dll or libjvm.so, because JVM only has
 630   // JVM_xxxx and a few other symbols in the dynamic symbol table. Do this
 631   // only for native libraries.
 632   if (!in_vm || Decoder::can_decode_C_frame_in_vm()) {
 633     found = os::dll_address_to_function_name(pc, buf, buflen, &offset);
 634 
 635     if (found) {
 636       st->print("  %s+0x%x", buf, offset);
 637     }
 638   }
 639 }
 640 
 641 // frame::print_on_error() is called by fatal error handler. Notice that we may
 642 // crash inside this function if stack frame is corrupted. The fatal error
 643 // handler can catch and handle the crash. Here we assume the frame is valid.
 644 //
 645 // First letter indicates type of the frame:
 646 //    J: Java frame (compiled)

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


 687           nmethod* nm = cm->as_nmethod();
 688           st->print("J %d%s", nm->compile_id(), (nm->is_osr_method() ? "%" : ""));
 689           st->print(" %s", nm->compiler_name());
 690         }
 691         m->name_and_sig_as_C_string(buf, buflen);
 692         st->print(" %s", buf);
 693         ModuleEntry* module = m->method_holder()->module();
 694         if (module->is_named()) {
 695           module->name()->as_C_string(buf, buflen);
 696           st->print(" %s", buf);
 697           module->version()->as_C_string(buf, buflen);
 698           st->print("@%s", buf);
 699         }
 700         st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]",
 701                   m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin());
 702 #if INCLUDE_JVMCI
 703         if (cm->is_nmethod()) {
 704           nmethod* nm = cm->as_nmethod();
 705           char* jvmciName = nm->jvmci_installed_code_name(buf, buflen);
 706           if (jvmciName != NULL) {


1245     // Report each stack element and mark as owned by this frame
1246     for (int e = 0; e < mask.expression_stack_size(); e++) {
1247       tos = MAX2(tos, interpreter_frame_expression_stack_at(e));
1248       values.describe(frame_no, interpreter_frame_expression_stack_at(e),
1249                       err_msg("stack %d", e));
1250     }
1251     if (tos != NULL) {
1252       values.describe(-1, tos, err_msg("expression stack for #%d", frame_no), 1);
1253     }
1254     if (interpreter_frame_monitor_begin() != interpreter_frame_monitor_end()) {
1255       values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin");
1256       values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end");
1257     }
1258   } else if (is_entry_frame()) {
1259     // For now just label the frame
1260     values.describe(-1, info_address, err_msg("#%d entry frame", frame_no), 2);
1261   } else if (is_compiled_frame()) {
1262     // For now just label the frame
1263     CompiledMethod* cm = (CompiledMethod*)cb();
1264     values.describe(-1, info_address,
1265                     FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no,
1266                                        p2i(cm), cm->method()->name_and_sig_as_C_string(),


1267                                        (_deopt_state == is_deoptimized) ?
1268                                        " (deoptimized)" :
1269                                        ((_deopt_state == unknown) ? " (state unknown)" : "")),
1270                     2);
1271   } else if (is_native_frame()) {
1272     // For now just label the frame
1273     nmethod* nm = cb()->as_nmethod_or_null();
1274     values.describe(-1, info_address,
1275                     FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no,
1276                                        p2i(nm), nm->method()->name_and_sig_as_C_string()), 2);
1277   } else {
1278     // provide default info if not handled before
1279     char *info = (char *) "special frame";
1280     if ((_cb != NULL) &&
1281         (_cb->name() != NULL)) {
1282       info = (char *)_cb->name();
1283     }
1284     values.describe(-1, info_address, err_msg("#%d <%s>", frame_no, info), 2);
1285   }
1286 




 627 
 628   // function name - os::dll_address_to_function_name() may return confusing
 629   // names if pc is within jvm.dll or libjvm.so, because JVM only has
 630   // JVM_xxxx and a few other symbols in the dynamic symbol table. Do this
 631   // only for native libraries.
 632   if (!in_vm || Decoder::can_decode_C_frame_in_vm()) {
 633     found = os::dll_address_to_function_name(pc, buf, buflen, &offset);
 634 
 635     if (found) {
 636       st->print("  %s+0x%x", buf, offset);
 637     }
 638   }
 639 }
 640 
 641 // frame::print_on_error() is called by fatal error handler. Notice that we may
 642 // crash inside this function if stack frame is corrupted. The fatal error
 643 // handler can catch and handle the crash. Here we assume the frame is valid.
 644 //
 645 // First letter indicates type of the frame:
 646 //    J: Java frame (compiled)
 647 //    A: Java frame (aot compiled)
 648 //    j: Java frame (interpreted)
 649 //    V: VM frame (C/C++)
 650 //    v: Other frames running VM generated code (e.g. stubs, adapters, etc.)
 651 //    C: C/C++ frame
 652 //
 653 // We don't need detailed frame type as that in frame::print_name(). "C"
 654 // suggests the problem is in user lib; everything else is likely a VM bug.
 655 
 656 void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const {
 657   if (_cb != NULL) {
 658     if (Interpreter::contains(pc())) {
 659       Method* m = this->interpreter_frame_method();
 660       if (m != NULL) {
 661         m->name_and_sig_as_C_string(buf, buflen);
 662         st->print("j  %s", buf);
 663         st->print("+%d", this->interpreter_frame_bci());
 664         ModuleEntry* module = m->method_holder()->module();
 665         if (module->is_named()) {
 666           module->name()->as_C_string(buf, buflen);
 667           st->print(" %s", buf);
 668           module->version()->as_C_string(buf, buflen);
 669           st->print("@%s", buf);
 670         }
 671       } else {
 672         st->print("j  " PTR_FORMAT, p2i(pc()));
 673       }
 674     } else if (StubRoutines::contains(pc())) {
 675       StubCodeDesc* desc = StubCodeDesc::desc_for(pc());
 676       if (desc != NULL) {
 677         st->print("v  ~StubRoutines::%s", desc->name());
 678       } else {
 679         st->print("v  ~StubRoutines::" PTR_FORMAT, p2i(pc()));
 680       }
 681     } else if (_cb->is_buffer_blob()) {
 682       st->print("v  ~BufferBlob::%s", ((BufferBlob *)_cb)->name());
 683     } else if (_cb->is_compiled()) {
 684       CompiledMethod* cm = (CompiledMethod*)_cb;
 685       Method* m = cm->method();
 686       if (m != NULL) {
 687         if (cm->is_aot()) {
 688           st->print("A %d ", cm->compile_id());
 689         } else if (cm->is_nmethod()) {
 690           nmethod* nm = cm->as_nmethod();
 691           st->print("J %d%s", nm->compile_id(), (nm->is_osr_method() ? "%" : ""));
 692           st->print(" %s", nm->compiler_name());
 693         }
 694         m->name_and_sig_as_C_string(buf, buflen);
 695         st->print(" %s", buf);
 696         ModuleEntry* module = m->method_holder()->module();
 697         if (module->is_named()) {
 698           module->name()->as_C_string(buf, buflen);
 699           st->print(" %s", buf);
 700           module->version()->as_C_string(buf, buflen);
 701           st->print("@%s", buf);
 702         }
 703         st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]",
 704                   m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin());
 705 #if INCLUDE_JVMCI
 706         if (cm->is_nmethod()) {
 707           nmethod* nm = cm->as_nmethod();
 708           char* jvmciName = nm->jvmci_installed_code_name(buf, buflen);
 709           if (jvmciName != NULL) {


1248     // Report each stack element and mark as owned by this frame
1249     for (int e = 0; e < mask.expression_stack_size(); e++) {
1250       tos = MAX2(tos, interpreter_frame_expression_stack_at(e));
1251       values.describe(frame_no, interpreter_frame_expression_stack_at(e),
1252                       err_msg("stack %d", e));
1253     }
1254     if (tos != NULL) {
1255       values.describe(-1, tos, err_msg("expression stack for #%d", frame_no), 1);
1256     }
1257     if (interpreter_frame_monitor_begin() != interpreter_frame_monitor_end()) {
1258       values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin");
1259       values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end");
1260     }
1261   } else if (is_entry_frame()) {
1262     // For now just label the frame
1263     values.describe(-1, info_address, err_msg("#%d entry frame", frame_no), 2);
1264   } else if (is_compiled_frame()) {
1265     // For now just label the frame
1266     CompiledMethod* cm = (CompiledMethod*)cb();
1267     values.describe(-1, info_address,
1268                     FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s%s", frame_no,
1269                                        p2i(cm),
1270                                        (cm->is_aot() ? "A ": "J "),
1271                                        cm->method()->name_and_sig_as_C_string(),
1272                                        (_deopt_state == is_deoptimized) ?
1273                                        " (deoptimized)" :
1274                                        ((_deopt_state == unknown) ? " (state unknown)" : "")),
1275                     2);
1276   } else if (is_native_frame()) {
1277     // For now just label the frame
1278     nmethod* nm = cb()->as_nmethod_or_null();
1279     values.describe(-1, info_address,
1280                     FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no,
1281                                        p2i(nm), nm->method()->name_and_sig_as_C_string()), 2);
1282   } else {
1283     // provide default info if not handled before
1284     char *info = (char *) "special frame";
1285     if ((_cb != NULL) &&
1286         (_cb->name() != NULL)) {
1287       info = (char *)_cb->name();
1288     }
1289     values.describe(-1, info_address, err_msg("#%d <%s>", frame_no, info), 2);
1290   }
1291 


src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File