mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-15 20:58:13 +01:00
Make the dwarf dl_iterate_phdr callback available within libunwind.
Rename the dwarf dl_iterate_phdr callback routine and the callback_data structure to dwarf_callback and dwarf_callback_data. Make it available within libunwind by declaring the two at the dwarf.h header file. Signed-off-by: Ken Werner <ken.werner@linaro.org>
This commit is contained in:
parent
25f6b8295d
commit
0b9f591823
2 changed files with 20 additions and 18 deletions
|
@ -347,8 +347,21 @@ struct unw_debug_frame_list
|
||||||
struct unw_debug_frame_list *next;
|
struct unw_debug_frame_list *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct dwarf_callback_data
|
||||||
|
{
|
||||||
|
/* in: */
|
||||||
|
unw_word_t ip; /* instruction-pointer we're looking for */
|
||||||
|
unw_proc_info_t *pi; /* proc-info pointer */
|
||||||
|
int need_unwind_info;
|
||||||
|
/* out: */
|
||||||
|
int single_fde; /* did we find a single FDE? (vs. a table) */
|
||||||
|
unw_dyn_info_t di; /* table info (if single_fde is false) */
|
||||||
|
unw_dyn_info_t di_debug; /* additional table info for .debug_frame */
|
||||||
|
};
|
||||||
|
|
||||||
/* Convenience macros: */
|
/* Convenience macros: */
|
||||||
#define dwarf_init UNW_ARCH_OBJ (dwarf_init)
|
#define dwarf_init UNW_ARCH_OBJ (dwarf_init)
|
||||||
|
#define dwarf_callback UNW_OBJ (dwarf_callback)
|
||||||
#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info)
|
#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info)
|
||||||
#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame)
|
#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame)
|
||||||
#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table)
|
#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table)
|
||||||
|
@ -364,6 +377,7 @@ struct unw_debug_frame_list
|
||||||
#define dwarf_step UNW_OBJ (dwarf_step)
|
#define dwarf_step UNW_OBJ (dwarf_step)
|
||||||
|
|
||||||
extern int dwarf_init (void);
|
extern int dwarf_init (void);
|
||||||
|
extern int dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr);
|
||||||
extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
|
extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
|
||||||
unw_proc_info_t *pi,
|
unw_proc_info_t *pi,
|
||||||
int need_unwind_info, void *arg);
|
int need_unwind_info, void *arg);
|
||||||
|
|
|
@ -47,18 +47,6 @@ struct table_entry
|
||||||
#include "os-linux.h"
|
#include "os-linux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct callback_data
|
|
||||||
{
|
|
||||||
/* in: */
|
|
||||||
unw_word_t ip; /* instruction-pointer we're looking for */
|
|
||||||
unw_proc_info_t *pi; /* proc-info pointer */
|
|
||||||
int need_unwind_info;
|
|
||||||
/* out: */
|
|
||||||
int single_fde; /* did we find a single FDE? (vs. a table) */
|
|
||||||
unw_dyn_info_t di; /* table info (if single_fde is false) */
|
|
||||||
unw_dyn_info_t di_debug; /* additional table info for .debug_frame */
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
linear_search (unw_addr_space_t as, unw_word_t ip,
|
linear_search (unw_addr_space_t as, unw_word_t ip,
|
||||||
unw_word_t eh_frame_start, unw_word_t eh_frame_end,
|
unw_word_t eh_frame_start, unw_word_t eh_frame_end,
|
||||||
|
@ -567,13 +555,13 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug,
|
||||||
|
|
||||||
#endif /* CONFIG_DEBUG_FRAME */
|
#endif /* CONFIG_DEBUG_FRAME */
|
||||||
|
|
||||||
/* ptr is a pointer to a callback_data structure and, on entry,
|
/* ptr is a pointer to a dwarf_callback_data structure and, on entry,
|
||||||
member ip contains the instruction-pointer we're looking
|
member ip contains the instruction-pointer we're looking
|
||||||
for. */
|
for. */
|
||||||
static int
|
HIDDEN int
|
||||||
callback (struct dl_phdr_info *info, size_t size, void *ptr)
|
dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr)
|
||||||
{
|
{
|
||||||
struct callback_data *cb_data = ptr;
|
struct dwarf_callback_data *cb_data = ptr;
|
||||||
unw_dyn_info_t *di = &cb_data->di;
|
unw_dyn_info_t *di = &cb_data->di;
|
||||||
const Elf_W(Phdr) *phdr, *p_eh_hdr, *p_dynamic, *p_text;
|
const Elf_W(Phdr) *phdr, *p_eh_hdr, *p_dynamic, *p_text;
|
||||||
unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, ip;
|
unw_word_t addr, eh_frame_start, eh_frame_end, fde_count, ip;
|
||||||
|
@ -754,7 +742,7 @@ HIDDEN int
|
||||||
dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
|
dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
|
||||||
unw_proc_info_t *pi, int need_unwind_info, void *arg)
|
unw_proc_info_t *pi, int need_unwind_info, void *arg)
|
||||||
{
|
{
|
||||||
struct callback_data cb_data;
|
struct dwarf_callback_data cb_data;
|
||||||
intrmask_t saved_mask;
|
intrmask_t saved_mask;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -768,7 +756,7 @@ dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
|
||||||
cb_data.di_debug.format = -1;
|
cb_data.di_debug.format = -1;
|
||||||
|
|
||||||
SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
|
SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask);
|
||||||
ret = dl_iterate_phdr (callback, &cb_data);
|
ret = dl_iterate_phdr (dwarf_callback, &cb_data);
|
||||||
SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
|
SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL);
|
||||||
|
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
|
|
Loading…
Reference in a new issue