8217879: hs_err should print more instructions in hex dump
authorshade
Fri, 01 Feb 2019 16:03:15 +0100
changeset 53605 853c68ff2ed7
parent 53604 635361ec5491
child 53606 c153b4c52e39
8217879: hs_err should print more instructions in hex dump Reviewed-by: stuefe, coleenp, dholmes, lucy, stefank
src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp
src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp
src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp
src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
src/hotspot/share/runtime/os.cpp
src/hotspot/share/runtime/os.hpp
--- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -561,8 +561,7 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Aix::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
-  print_hex_dump(st, pc - 64, pc + 64, /*instrsize=*/4);
+  print_instructions(st, pc, /*instrsize=*/4);
   st->cr();
 
   // Try to decode the instructions.
--- a/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -1021,8 +1021,8 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Bsd::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", (intptr_t)pc);
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -606,8 +606,8 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -543,8 +543,8 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc - 32, pc + 32, Assembler::InstructionSize);
+  print_instructions(st, pc, Assembler::InstructionSize);
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -574,8 +574,7 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc - 64, pc + 64, /*instrsize=*/4);
+  print_instructions(st, pc, /*instrsize=*/4);
   st->cr();
 }
 
--- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -605,9 +605,7 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  if (Verbose) { st->print_cr("pc at " PTR_FORMAT, p2i(pc)); }
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc-64, pc+64, /*intrsize=*/4);
+  print_instructions(st, pc, /*intrsize=*/4);
   st->cr();
 }
 
--- a/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_sparc/os_linux_sparc.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -232,8 +232,8 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 
--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -755,8 +755,8 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/solaris_sparc/os_solaris_sparc.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -655,8 +655,8 @@
   // this at the end, and hope for the best.
   ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc);
   address pc = epc.pc();
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/solaris_x86/os_solaris_x86.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -779,8 +779,8 @@
   // this at the end, and hope for the best.
   ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc);
   address pc = epc.pc();
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
+  st->cr();
 }
 
 void os::print_register_info(outputStream *st, const void *context) {
--- a/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -585,8 +585,7 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = (address)uc->REG_PC;
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
-  print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
+  print_instructions(st, pc, sizeof(char));
   st->cr();
 }
 
--- a/src/hotspot/share/runtime/os.cpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/share/runtime/os.cpp	Fri Feb 01 16:03:15 2019 +0100
@@ -909,6 +909,11 @@
   st->cr();
 }
 
+void os::print_instructions(outputStream* st, address pc, int unitsize) {
+  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
+  print_hex_dump(st, pc - 256, pc + 256, unitsize);
+}
+
 void os::print_environment_variables(outputStream* st, const char** env_list) {
   if (env_list) {
     st->print_cr("Environment Variables:");
--- a/src/hotspot/share/runtime/os.hpp	Fri Feb 01 14:24:40 2019 +0000
+++ b/src/hotspot/share/runtime/os.hpp	Fri Feb 01 16:03:15 2019 +0100
@@ -640,6 +640,7 @@
   static void print_siginfo(outputStream* st, const void* siginfo);
   static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
   static void print_date_and_time(outputStream* st, char* buf, size_t buflen);
+  static void print_instructions(outputStream* st, address pc, int unitsize);
 
   static void print_location(outputStream* st, intptr_t x, bool verbose = false);
   static size_t lasterror(char *buf, size_t len);