changeset 52135:9e6158f12068

8211852: inspect stack during error reporting Reviewed-by: dholmes, goetz
author mdoerr
date Mon, 15 Oct 2018 08:08:02 +0200
parents 3b8994cb4481
children f0340f0ea249
files src/hotspot/share/runtime/os.cpp src/hotspot/share/utilities/vmError.cpp
diffstat 2 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/runtime/os.cpp	Sun Oct 14 19:07:34 2018 -0700
+++ b/src/hotspot/share/runtime/os.cpp	Mon Oct 15 08:08:02 2018 +0200
@@ -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;
   }
 
--- a/src/hotspot/share/utilities/vmError.cpp	Sun Oct 14 19:07:34 2018 -0700
+++ b/src/hotspot/share/utilities/vmError.cpp	Mon Oct 15 08:08:02 2018 +0200
@@ -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) {