diff src/share/vm/utilities/vmError.cpp @ 16719:b1911c1e44c8

Dump disassembly in crash log
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 07 Aug 2014 11:06:09 -0700
parents 4ca6dc0799b6
children 3eed8712d410
line wrap: on
line diff
--- a/src/share/vm/utilities/vmError.cpp	Thu Aug 07 11:05:12 2014 -0700
+++ b/src/share/vm/utilities/vmError.cpp	Thu Aug 07 11:06:09 2014 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "compiler/compileBroker.hpp"
+#include "compiler/disassembler.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
@@ -532,6 +533,32 @@
        st->cr();
      }
 
+  STEP(102, "(printing code blob if possible)")
+
+     if (_verbose && _context) {
+       address pc = os::get_pc(_context);
+       CodeBlob* cb = CodeCache::find_blob(pc);
+       if (cb != NULL) {
+         if (Interpreter::contains(pc)) {
+           // The interpreter CodeBlob is very large so try to print the codelet instead.
+           InterpreterCodelet* codelet = Interpreter::codelet_containing(pc);
+           if (codelet != NULL) {
+             codelet->print_on(st);
+             Disassembler::decode(codelet->code_begin(), codelet->code_end(), st);
+           }
+         } else {
+           StubCodeDesc* desc = StubCodeDesc::desc_for(pc);
+           if (desc != NULL) {
+             desc->print_on(st);
+             Disassembler::decode(desc->begin(), desc->end(), st);
+           } else {
+             Disassembler::decode(cb, st);
+             st->cr();
+           }
+         }
+       }
+     }
+
   STEP(105, "(printing register info)")
 
      // decode register contents if possible