8294679: RISC-V: Misc crash dump improvements

Reviewed-by: fjiang, shade
This commit is contained in:
Fei Yang 2022-10-06 01:21:18 +00:00
parent e986a97a96
commit 8f5611593a

View File

@ -145,6 +145,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);
}
@ -357,8 +363,8 @@ void os::print_tos_pc(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();
}