libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] [PATCH 3/5] Rework the lookup of the ARM specific


From: Arun Sharma
Subject: Re: [Libunwind-devel] [PATCH 3/5] Rework the lookup of the ARM specific unwind entry for local unwinding
Date: Thu, 11 Aug 2011 22:14:03 -0700

On Mon, Aug 8, 2011 at 1:03 PM, Ken Werner <address@hidden> wrote:
>> Could we make just the callback from dl_iterate_phdr target dependent?
>
> You mean to register a target dependent callback with dl_iterate_phdr or to
> call a target dependent routine from the callback itself? In both cases we'd
> want check for .eh_frame/.ARM.exidx infos and fall back to DWARF
> (.debug_frame) parsing if there are no unwind infos for the given IP.
> The tdep_find_proc_info is supposed to find the corresponding unwind info
> which means to populate unw_proc_info. Since this is a fairly complicated
> task the implementations of that routine (e.g. dwarf_search_unwind_table,
> _UPT_find_proc_info or GDB) only walk the program headers to find ELF
> segments that contain unwind informations (unw_dyn_info) and call back to
> libunwinds tdep_search_unwind_table (sometimes multiple times) to get a
> proper unw_proc_info. I didn't want to change this sequence because these
> two functions are part of the public API. Maybe I'm missing something. Any
> suggestions are welcome.

Something along the lines of:

--- a/include/tdep-arm/libunwind_i.h
+++ b/include/tdep-arm/libunwind_i.h
@@ -243,9 +243,6 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t
loc, unw_word_t val)
 #define tdep_trace(cur,addr,n)         (-UNW_ENOINFO)

 #ifdef UNW_LOCAL_ONLY
-# define tdep_find_proc_info(c,ip,n)                           \
-       dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n),      \
-                                      (c)->as_arg)
 # define tdep_put_unwind_info(as,pi,arg)               \
        dwarf_put_unwind_info((as), (pi), (arg))
 #else
diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c
index d65342c..bec3c24 100644
--- a/src/dwarf/Gfind_proc_info-lsb.c
+++ b/src/dwarf/Gfind_proc_info-lsb.c
@@ -570,8 +570,8 @@ dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug,
 /* ptr is a pointer to a 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;
   unw_dyn_info_t *di = &cb_data->di;
@@ -768,7 +768,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)

And implement  tdep_find_proc_info() in src/arm. This would be similar
to src/ia64, except that ia64 doesn't use any of the dwarf code. You
could have a arm_callback() that reuses the code in dwarf_callback().

 -Arun



reply via email to

[Prev in Thread] Current Thread [Next in Thread]