@@ -145,6 +145,12 @@ frame os::fetch_frame_from_context(const void* ucVoid) {
145
145
intptr_t * frame_sp = NULL ;
146
146
intptr_t * frame_fp = NULL ;
147
147
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
+ }
148
154
return frame (frame_sp, frame_fp, epc);
149
155
}
150
156
@@ -357,8 +363,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {
357
363
// Note: it may be unsafe to inspect memory near pc. For example, pc may
358
364
// point to garbage if entry point in an nmethod is corrupted. Leave
359
365
// 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 );
362
368
st->cr ();
363
369
}
364
370
1 commit comments
openjdk-notifier[bot] commentedon Oct 6, 2022
Review
Issues