static inline void put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi) { if (c->pi_is_dynamic) unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg); else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE) { mempool_free (&dwarf_cie_info_pool, pi->unwind_info); pi->unwind_info = NULL; } }
static inline void put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi) { if (!c->pi_valid) return; if (c->pi_is_dynamic) unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg); else if (pi->unwind_info) { mempool_free (&dwarf_cie_info_pool, pi->unwind_info); pi->unwind_info = NULL; } }
static inline int get_proc_name (unw_addr_space_t as, unw_word_t ip, char *buf, size_t buf_len, unw_word_t *offp, void *arg) { unw_accessors_t *a = unw_get_accessors (as); unw_proc_info_t pi; int ret; buf[0] = '\0'; /* always return a valid string, even if it's empty */ ret = unwi_find_dynamic_proc_info (as, ip, &pi, 1, arg); if (ret == 0) { unw_dyn_info_t *di = pi.unwind_info; if (offp) *offp = ip - pi.start_ip; switch (di->format) { case UNW_INFO_FORMAT_DYNAMIC: ret = intern_string (as, a, di->u.pi.name_ptr, buf, buf_len, arg); break; case UNW_INFO_FORMAT_TABLE: case UNW_INFO_FORMAT_REMOTE_TABLE: /* XXX should we create a fake name, e.g.: "tablenameN", where N is the index of the function in the table??? */ ret = -UNW_ENOINFO; break; default: ret = -UNW_EINVAL; break; } unwi_put_dynamic_unwind_info (as, &pi, arg); return ret; } if (ret != -UNW_ENOINFO) return ret; /* not a dynamic procedure, try to lookup static procedure name: */ if (a->get_proc_name) return (*a->get_proc_name) (as, ip, buf, buf_len, offp, arg); return -UNW_ENOINFO; }