diff mbox

[1/4] Make the dwarf dl_iterate_phdr callback available within libunwind.

Message ID 1313432594-23980-2-git-send-email-ken.werner@linaro.org
State Accepted
Commit 0b9f591823474c9651acdffec68256e077e4d601
Headers show

Commit Message

Ken Werner Aug. 15, 2011, 6:23 p.m. UTC
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>
---
 include/dwarf.h                 |   14 ++++++++++++++
 src/dwarf/Gfind_proc_info-lsb.c |   24 ++++++------------------
 2 files changed, 20 insertions(+), 18 deletions(-)
diff mbox

Patch

diff --git a/include/dwarf.h b/include/dwarf.h
index 334aaad..3fe6b48 100644
--- a/include/dwarf.h
+++ b/include/dwarf.h
@@ -347,8 +347,21 @@  struct unw_debug_frame_list
     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: */
 #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_debug_frame		UNW_OBJ (dwarf_find_debug_frame)
 #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)
 
 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,
 				 unw_proc_info_t *pi,
 				 int need_unwind_info, void *arg);
diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c
index d65342c..22899d8 100644
--- a/src/dwarf/Gfind_proc_info-lsb.c
+++ b/src/dwarf/Gfind_proc_info-lsb.c
@@ -47,18 +47,6 @@  struct table_entry
 #include "os-linux.h"
 #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
 linear_search (unw_addr_space_t as, unw_word_t ip,
 	       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 */
 
-/* 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
    for.  */
-static int
-callback (struct dl_phdr_info *info, size_t size, void *ptr)
+HIDDEN int
+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;
   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;
@@ -754,7 +742,7 @@  HIDDEN int
 dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip,
 		      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;
   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;
 
   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);
 
   if (ret <= 0)