151 return (fence == FENCE_MAIN) || (fence == FENCE_THREAD);
159 if (monitor_unwind_process_bottom_frame(ip))
161 else if (monitor_unwind_thread_bottom_frame(ip))
164 if (
ENABLED(FENCE_UNW) && rv != FENCE_NONE)
174 assert(reg_id == UNW_REG_IP);
185 assert(reg_id == UNW_REG_IP);
230 ucontext_t* ctxt = (ucontext_t*)context;
242 cursor->
ra = (
void*)(ctxt->uc_mcontext.regs->link);
245 cursor->
ra = (
void*)(ctxt->uc_mcontext.regs->gpr[
UWI_RECIPE(intvl)->ra_arg]);
250 EMSG(
"unw_init: cursor could NOT build an interval for initial pc = %p",
256 TMSG(UNW,
"init: pc=%p, ra=%p, sp=%p, fp=%p",
270 void** sp = cursor->
sp;
271 void** fp = cursor->
bp;
278 void** nxt_sp =
NULL;
279 void** nxt_fp =
NULL;
284 TMSG(UNW,
"error: missing interval for pc=%p", pc);
296 TMSG(UNW,
"unw_step: STEP_STOP, current pc in monitor fence pc=%p\n", cursor->
pc_unnorm);
300 if ((
void*)sp >= monitor_stack_bottom()) {
301 TMSG(FENCE_UNW,
"stop: sp (%p) >= unw_stack_bottom", sp);
302 cursor->
fence = FENCE_MAIN;
318 TMSG(UNW,
"warning: correcting sp: %p -> %p", sp, nxt_sp);
327 EMSG(
"unwind failure computing SP at pc: %p, sp: %p", pc, sp);
341 TMSG(UNW,
"warning: correcting pc: %p -> %p", cursor->
ra, nxt_pc);
349 EMSG(
"unwind failure computing RA at pc: %p, sp: %p", pc, sp);
364 TMSG(UNW,
"warning: bad nxt pc=%p; sp=%p, fp=%p...", nxt_pc, sp, fp);
370 void** try_sp =
NULL;
371 if (!isInteriorFrm) {
385 TMSG(UNW,
"error: skip-frame failed: nxt pc=%p, sp=%p; try sp=%p",
386 nxt_pc, nxt_sp, try_sp);
392 TMSG(UNW,
"skip-frame: nxt pc=%p, sp=%p", nxt_pc, nxt_sp);
402 TMSG(UNW,
"error: loop! nxt_sp=%p, sp=%p", nxt_sp, sp);
407 TMSG(UNW,
"next: pc=%p, sp=%p, fp=%p", nxt_pc, nxt_sp, nxt_fp);
ip_normalized_t hpcrun_normalize_ip(void *unnormalized_ip, load_module_t *lm)
static void ** ucontext_sp(ucontext_t *context)
#define ip_normalized_NULL
static void compute_normalized_ips(hpcrun_unw_cursor_t *cursor)
static fence_enum_t hpcrun_check_fence(void *ip)
void hpcrun_unw_init_cursor(hpcrun_unw_cursor_t *cursor, void *context)
struct ip_normalized_t ip_normalized_t
static void * getNxtPCFromSP(void **sp)
static bool isPossibleParentSP(void **sp, void **parent_sp)
static bool fence_stop(fence_enum_t fence)
static void save_registers(hpcrun_unw_cursor_t *cursor, void *pc, void *bp, void *sp, void *ra)
static int hpcrun_unw_get_unnorm_reg(hpcrun_unw_cursor_t *cursor, unw_reg_code_t reg_id, void **reg_value)
#define UWI_RECIPE(btuwi)
bool uw_recipe_map_lookup(void *addr, unwinder_t uw, unwindr_info_t *unwr_info)
step_state hpcrun_unw_step(hpcrun_unw_cursor_t *cursor)
static int hpcrun_unw_get_norm_reg(hpcrun_unw_cursor_t *cursor, unw_reg_code_t reg_id, ip_normalized_t *reg_value)
int hpcrun_unw_get_ip_unnorm_reg(hpcrun_unw_cursor_t *c, void **reg_value)
struct bitree_uwi_s bitree_uwi_t
int hpcrun_unw_get_ip_norm_reg(hpcrun_unw_cursor_t *c, ip_normalized_t *reg_value)
void hpcrun_unw_init(void)
unw_frame_regnum_t unw_reg_code_t
ip_normalized_t the_function
void ui_dump(unwind_interval *u)
void * hpcrun_unw_get_ra_loc(hpcrun_unw_cursor_t *cursor)
bitree_uwi_t unwind_interval
static void * ucontext_pc(ucontext_t *context)
static char * fence_enum_name(fence_enum_t f)
void uw_recipe_map_init(void)