8230762: Change MacroAssembler::debug32/64 to use fatal instead of assert
authorchagedorn
Thu, 12 Sep 2019 12:12:26 +0200
changeset 58103 689a80d20550
parent 58102 b2a4b22f8cf2
child 58104 46e11f978852
8230762: Change MacroAssembler::debug32/64 to use fatal instead of assert Summary: Always call fatal from debug32/64 to also crash in product build as a follow-up to JDK-8225653. Reviewed-by: roland, thartmann
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
src/hotspot/cpu/x86/macroAssembler_x86.cpp
src/hotspot/cpu/x86/stubGenerator_x86_32.cpp
src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Fri Aug 23 14:22:29 2019 +0200
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Sep 12 12:12:26 2019 +0200
@@ -2557,13 +2557,8 @@
       tty->print_cr("r31 = 0x%016lx", regs[31]);
       BREAKPOINT;
     }
-    ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
-  } else {
-    ttyLocker ttyl;
-    ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n",
-                    msg);
-    assert(false, "DEBUG MESSAGE: %s", msg);
   }
+  fatal("DEBUG MESSAGE: %s", msg);
 }
 
 void MacroAssembler::push_call_clobbered_registers() {
--- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Fri Aug 23 14:22:29 2019 +0200
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Thu Sep 12 12:12:26 2019 +0200
@@ -598,6 +598,7 @@
     BLOCK_COMMENT("call MacroAssembler::debug");
     __ mov(rscratch1, CAST_FROM_FN_PTR(address, MacroAssembler::debug64));
     __ blr(rscratch1);
+    __ hlt(0);
 
     return start;
   }
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Fri Aug 23 14:22:29 2019 +0200
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Thu Sep 12 12:12:26 2019 +0200
@@ -427,13 +427,8 @@
       print_state32(rdi, rsi, rbp, rsp, rbx, rdx, rcx, rax, eip);
       BREAKPOINT;
     }
-  } else {
-    ttyLocker ttyl;
-    ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg);
-  }
-  // Don't assert holding the ttyLock
-    assert(false, "DEBUG MESSAGE: %s", msg);
-  ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
+  }
+  fatal("DEBUG MESSAGE: %s", msg);
 }
 
 void MacroAssembler::print_state32(int rdi, int rsi, int rbp, int rsp, int rbx, int rdx, int rcx, int rax, int eip) {
@@ -892,15 +887,9 @@
     if (os::message_box(msg, "Execution stopped, print registers?")) {
       print_state64(pc, regs);
       BREAKPOINT;
-      assert(false, "start up GDB");
     }
-    ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
-  } else {
-    ttyLocker ttyl;
-    ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n",
-                    msg);
-    assert(false, "DEBUG MESSAGE: %s", msg);
-  }
+  }
+  fatal("DEBUG MESSAGE: %s", msg);
 }
 
 void MacroAssembler::print_state64(int64_t pc, int64_t regs[]) {
--- a/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Fri Aug 23 14:22:29 2019 +0200
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_32.cpp	Thu Sep 12 12:12:26 2019 +0200
@@ -710,8 +710,7 @@
     __ pusha();                                  // push registers (eip = return address & msg are already pushed)
     BLOCK_COMMENT("call MacroAssembler::debug");
     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug32)));
-    __ popa();
-    __ ret(3 * wordSize);                        // pop arguments
+    __ hlt();
     return start;
   }
 
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Fri Aug 23 14:22:29 2019 +0200
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Thu Sep 12 12:12:26 2019 +0200
@@ -1129,10 +1129,7 @@
     __ andptr(rsp, -16);                            // align stack as required by ABI
     BLOCK_COMMENT("call MacroAssembler::debug");
     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
-    __ mov(rsp, r12);                               // restore rsp
-    __ popa();                                      // pop registers (includes r12)
-    __ ret(4 * wordSize);                           // pop caller saved stuff
-
+    __ hlt();
     return start;
   }