59 #define UNW_LOCAL_ONLY 69 #include <include/hpctoolkit-config.h> 96 #define DEBUG_LIBUNWIND_INTERFACE 0 104 #if DEBUG_LIBUNWIND_INTERFACE 105 static int libunwind_debug = 0;
114 #if DEBUG_LIBUNWIND_INTERFACE 119 return libunwind_debug;
124 libunwind_debug_off()
127 return libunwind_debug;
137 #if DEBUG_LIBUNWIND_INTERFACE 141 switch(cursor->
fence) {
142 case FENCE_MAIN:
return "FENCE_MAIN";
143 case FENCE_NONE:
return "FENCE_NONE";
144 case FENCE_THREAD:
return "FENCE_THREAD";
145 case FENCE_BAD:
return "FENCE_BAD";
146 case FENCE_TRAMP:
return "FENCE_TRAMP";
155 case STEP_OK:
return "STEP_OK";
185 unw_cursor_t *unw_cursor = &(cursor->
uc);
186 unw_get_reg(unw_cursor, UNW_REG_IP, &tmp);
200 #if DEBUG_LIBUNWIND_INTERFACE 201 if (libunwind_debug) {
202 printf(
"ip = %p (%d, %lx) the_function=%p (%d,%lx) ",
216 TMSG(UNW,
"unw_step: advance pc: %p\n", pc);
219 #if DEBUG_LIBUNWIND_INTERFACE 220 if (libunwind_debug) {
221 printf(
"libunw_status = %s ", libunw_state_string(cursor->
libunw_status));
235 cursor->
fence = (monitor_unwind_process_bottom_frame(pc) ? FENCE_MAIN :
236 monitor_unwind_thread_bottom_frame(pc)? FENCE_THREAD : FENCE_NONE);
238 #if DEBUG_LIBUNWIND_INTERFACE 239 if (libunwind_debug) {
240 printf(
"fence = %s ", fence_string(cursor));
244 if (cursor->
fence != FENCE_NONE) {
245 TMSG(UNW,
"unw_step: stop at monitor fence: %p\n", pc);
251 TMSG(UNW,
"libunw_take_step: error: failed at: %p\n", pc);
256 unw_apply_reg_state(&(cursor->
uc), uwi->
recipe);
268 unw_cursor_t *unw_cursor = &(cursor->
uc);
269 unw_context_t *ctx = (unw_context_t *) context;
271 if (ctx !=
NULL && unw_init_local2(unw_cursor, ctx, UNW_INIT_SIGNAL_FRAME) == 0) {
291 unw_word_t start_ip, unw_word_t end_ip)
301 memcpy(uwi->
recipe, rs, size);
313 (void) unw_getcontext(&uc);
315 unw_init_local2(&c, &uc, UNW_INIT_SIGNAL_FRAME);
316 unw_set_reg(&c, UNW_REG_IP, (intptr_t)beg_insn);
317 void *space[2] __attribute((aligned (32)));
354 #if DEBUG_LIBUNWIND_INTERFACE 355 if (libunwind_debug) {
356 printf(
"result = %s\n", step_state_string(result));
ip_normalized_t hpcrun_normalize_ip(void *unnormalized_ip, load_module_t *lm)
static int dwarf_reg_states_callback(void *token, void *rs, size_t size, unw_word_t start_ip, unw_word_t end_ip)
bitree_uwi_t * bitree_uwi_rightsubtree(bitree_uwi_t *tree)
uwi_t * bitree_uwi_rootval(bitree_uwi_t *tree)
char * first_undecoded_ins
enum libunw_state libunw_status
bool uw_recipe_map_lookup(void *addr, unwinder_t uw, unwindr_info_t *unwr_info)
bitree_uwi_t * bitree_uwi_malloc(unwinder_t uw, size_t recipe_size)
static void compute_normalized_ips(hpcrun_unw_cursor_t *cursor)
static void * libunw_cursor_get_pc(hpcrun_unw_cursor_t *cursor)
void hpcrun_stats_num_unwind_intervals_total_inc(void)
struct bitree_uwi_s bitree_uwi_t
btuwi_status_t libunw_build_intervals(char *beg_insn, unsigned int len)
ip_normalized_t the_function
step_state libunw_take_step(hpcrun_unw_cursor_t *cursor)
enum unwinder_e unwinder_t
bool libunw_finalize_cursor(hpcrun_unw_cursor_t *cursor)
void libunw_uw_recipe_tostr(void *uwr, char str[])
void libunw_unw_init_cursor(hpcrun_unw_cursor_t *cursor, void *context)
step_state libunw_unw_step(hpcrun_unw_cursor_t *cursor)
void bitree_uwi_set_rightsubtree(bitree_uwi_t *tree, bitree_uwi_t *subtree)