1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-03 19:57:39 +01:00

find_proc_info refactoring

This commit is contained in:
Alexander Esilevich 2010-07-29 09:27:58 +07:00
parent 69bfe6f298
commit 35e1cb3ecb

View file

@ -561,6 +561,12 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr)
int err; int err;
unw_word_t fde_addr; unw_word_t fde_addr;
size_t table_len = (fde_count * sizeof (struct table_entry)
/ sizeof (unw_word_t));
/* For the binary-search table in the eh_frame_hdr, data-relative
means relative to the start of that section... */
unw_word_t segbase = (unw_word_t) (uintptr_t) hdr;
di->format = UNW_INFO_FORMAT_REMOTE_TABLE; di->format = UNW_INFO_FORMAT_REMOTE_TABLE;
di->start_ip = p_text->p_vaddr + load_base; di->start_ip = p_text->p_vaddr + load_base;
di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz; di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz;
@ -578,9 +584,10 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr)
(long) di->u.rti.segbase, (long) di->u.rti.table_len, (long) di->u.rti.segbase, (long) di->u.rti.table_len,
(long) di->gp, (long) di->u.rti.table_data); (long) di->gp, (long) di->u.rti.table_data);
err = dwarf_search_unwind_table_remote (cb_data->as, cb_data->ip, err = dwarf_search_unwind_table_ (cb_data->as, cb_data->ip,
di, &fde_addr, segbase, table_len,
need_unwind_info, cb_data->arg); addr, 0,
&fde_addr, need_unwind_info, cb_data->arg);
if(err < 0) if(err < 0)
return err; return err;
@ -914,24 +921,6 @@ dwarf_search_unwind_table_ (unw_addr_space_t as, unw_word_t ip,
} }
PROTECTED int
dwarf_search_unwind_table_remote (unw_addr_space_t as, unw_word_t ip,
unw_dyn_info_t *di, unw_word_t *fde_addr,
int need_unwind_info, void *arg)
{
const struct table_entry *table =
(const struct table_entry *) (uintptr_t) di->u.rti.table_data;
size_t table_len = di->u.rti.table_len * sizeof (unw_word_t);
unw_word_t segbase = di->u.rti.segbase;
assert (di->format = UNW_INFO_FORMAT_REMOTE_TABLE);
return dwarf_search_unwind_table_ (as, ip,
segbase, table_len,
table, 0,
fde_addr, need_unwind_info, arg);
}
PROTECTED int PROTECTED int
dwarf_search_unwind_table_local (unw_addr_space_t as, unw_word_t ip, dwarf_search_unwind_table_local (unw_addr_space_t as, unw_word_t ip,
struct unw_debug_frame_list *fdesc, struct unw_debug_frame_list *fdesc,