# HG changeset patch # User mdoerr # Date 1539248981 -7200 # Thu Oct 11 11:09:41 2018 +0200 # Node ID 42c37489cdb8386a24e022888b19f8b5cd665c65 # Parent 3be7d098f4a62fddecc9c31eabbd0fa4b1e46405 8211852: inspect stack during error reporting Reviewed-by: dholmes diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -1153,7 +1153,11 @@ } if (accessible) { - st->print_cr(INTPTR_FORMAT " points into unknown readable memory", p2i(addr)); + st->print(INTPTR_FORMAT " points into unknown readable memory:", p2i(addr)); + for (address p = addr; p < align_up(addr + 1, sizeof(intptr_t)); ++p) { + st->print(" %02x", *(u1*)p); + } + st->cr(); return; } diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -756,6 +756,24 @@ st->cr(); } + STEP("inspecting top of stack") + + // decode stack contents if possible + if (_verbose && _context && Universe::is_fully_initialized()) { + frame fr = os::fetch_frame_from_context(_context); + const int slots = 8; + const intptr_t *start = fr.sp(); + const intptr_t *end = start + slots; + if (is_aligned(start, sizeof(intptr_t)) && os::is_readable_range(start, end)) { + st->print_cr("Stack slot to memory mapping:"); + for (int i = 0; i < slots; ++i) { + st->print("stack at sp + %d slots: ", i); + os::print_location(st, *(start + i)); + } + } + st->cr(); + } + STEP("printing code blob if possible") if (_verbose && _context) {