Skip to content

Commit 8f56115

Browse files
committedOct 6, 2022
8294679: RISC-V: Misc crash dump improvements
Reviewed-by: fjiang, shade
1 parent e986a97 commit 8f56115

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
145145
intptr_t* frame_sp = NULL;
146146
intptr_t* frame_fp = NULL;
147147
address epc = fetch_frame_from_context(ucVoid, &frame_sp, &frame_fp);
148+
if (!is_readable_pointer(epc)) {
149+
// Try to recover from calling into bad memory
150+
// Assume new frame has not been set up, the same as
151+
// compiled frame stack bang
152+
return fetch_compiled_frame_from_context(ucVoid);
153+
}
148154
return frame(frame_sp, frame_fp, epc);
149155
}
150156

@@ -357,8 +363,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {
357363
// Note: it may be unsafe to inspect memory near pc. For example, pc may
358364
// point to garbage if entry point in an nmethod is corrupted. Leave
359365
// this at the end, and hope for the best.
360-
address pc = os::Posix::ucontext_get_pc(uc);
361-
print_instructions(st, pc, UseRVC ? sizeof(char) : 4/*non-compressed native instruction size*/);
366+
address pc = os::fetch_frame_from_context(uc).pc();
367+
print_instructions(st, pc, UseRVC ? sizeof(char) : (int)NativeInstruction::instruction_size);
362368
st->cr();
363369
}
364370

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Oct 6, 2022

@openjdk-notifier[bot]
Please sign in to comment.