Skip to content

Commit 9c145fa

Browse files
committed
8230762: Change MacroAssembler::debug32/64 to use fatal instead of assert
Always call fatal from debug32/64 to also crash in product build as a follow-up to JDK-8225653. Reviewed-by: roland, thartmann
1 parent ec5451c commit 9c145fa

File tree

5 files changed

+6
-25
lines changed

5 files changed

+6
-25
lines changed

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,13 +2557,8 @@ void MacroAssembler::debug64(char* msg, int64_t pc, int64_t regs[])
25572557
tty->print_cr("r31 = 0x%016lx", regs[31]);
25582558
BREAKPOINT;
25592559
}
2560-
ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
2561-
} else {
2562-
ttyLocker ttyl;
2563-
::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n",
2564-
msg);
2565-
assert(false, "DEBUG MESSAGE: %s", msg);
25662560
}
2561+
fatal("DEBUG MESSAGE: %s", msg);
25672562
}
25682563

25692564
void MacroAssembler::push_call_clobbered_registers() {

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ class StubGenerator: public StubCodeGenerator {
598598
BLOCK_COMMENT("call MacroAssembler::debug");
599599
__ mov(rscratch1, CAST_FROM_FN_PTR(address, MacroAssembler::debug64));
600600
__ blr(rscratch1);
601+
__ hlt(0);
601602

602603
return start;
603604
}

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,8 @@ void MacroAssembler::debug32(int rdi, int rsi, int rbp, int rsp, int rbx, int rd
427427
print_state32(rdi, rsi, rbp, rsp, rbx, rdx, rcx, rax, eip);
428428
BREAKPOINT;
429429
}
430-
} else {
431-
ttyLocker ttyl;
432-
::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg);
433430
}
434-
// Don't assert holding the ttyLock
435-
assert(false, "DEBUG MESSAGE: %s", msg);
436-
ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
431+
fatal("DEBUG MESSAGE: %s", msg);
437432
}
438433

439434
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 @@ void MacroAssembler::debug64(char* msg, int64_t pc, int64_t regs[]) {
892887
if (os::message_box(msg, "Execution stopped, print registers?")) {
893888
print_state64(pc, regs);
894889
BREAKPOINT;
895-
assert(false, "start up GDB");
896890
}
897-
ThreadStateTransition::transition(thread, _thread_in_vm, saved_state);
898-
} else {
899-
ttyLocker ttyl;
900-
::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n",
901-
msg);
902-
assert(false, "DEBUG MESSAGE: %s", msg);
903891
}
892+
fatal("DEBUG MESSAGE: %s", msg);
904893
}
905894

906895
void MacroAssembler::print_state64(int64_t pc, int64_t regs[]) {

src/hotspot/cpu/x86/stubGenerator_x86_32.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,8 +710,7 @@ class StubGenerator: public StubCodeGenerator {
710710
__ pusha(); // push registers (eip = return address & msg are already pushed)
711711
BLOCK_COMMENT("call MacroAssembler::debug");
712712
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug32)));
713-
__ popa();
714-
__ ret(3 * wordSize); // pop arguments
713+
__ hlt();
715714
return start;
716715
}
717716

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,10 +1129,7 @@ class StubGenerator: public StubCodeGenerator {
11291129
__ andptr(rsp, -16); // align stack as required by ABI
11301130
BLOCK_COMMENT("call MacroAssembler::debug");
11311131
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
1132-
__ mov(rsp, r12); // restore rsp
1133-
__ popa(); // pop registers (includes r12)
1134-
__ ret(4 * wordSize); // pop caller saved stuff
1135-
1132+
__ hlt();
11361133
return start;
11371134
}
11381135

0 commit comments

Comments
 (0)