Skip to content

Commit

Permalink
8294679: RISC-V: Misc crash dump improvements
Browse files Browse the repository at this point in the history
Reviewed-by: fyang
Backport-of: 8f5611593a8085242d773bb8c7ee8b077a261e80
  • Loading branch information
zifeihan authored and RealFYang committed Apr 25, 2023
1 parent bb56b80 commit bf59adf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
intptr_t* frame_sp = NULL;
intptr_t* frame_fp = NULL;
address epc = fetch_frame_from_context(ucVoid, &frame_sp, &frame_fp);
if (!is_readable_pointer(epc)) {
// Try to recover from calling into bad memory
// Assume new frame has not been set up, the same as
// compiled frame stack bang
return fetch_compiled_frame_from_context(ucVoid);
}
return frame(frame_sp, frame_fp, epc);
}

Expand Down Expand Up @@ -353,8 +359,8 @@ void os::print_context(outputStream *st, const void *context) {
// Note: it may be unsafe to inspect memory near pc. For example, pc may
// point to garbage if entry point in an nmethod is corrupted. Leave
// this at the end, and hope for the best.
address pc = os::Posix::ucontext_get_pc(uc);
print_instructions(st, pc, UseRVC ? sizeof(char) : 4/*non-compressed native instruction size*/);
address pc = os::fetch_frame_from_context(uc).pc();
print_instructions(st, pc, UseRVC ? sizeof(char) : (int)NativeInstruction::instruction_size);
st->cr();
}

Expand Down

0 comments on commit bf59adf

Please sign in to comment.