libunwind-devel
[Top][All Lists]
Advanced

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

[Libunwind-devel] [PATCH] Change _UPTi_find_unwind_table to return an in


From: Ken Werner
Subject: [Libunwind-devel] [PATCH] Change _UPTi_find_unwind_table to return an integer.
Date: Tue, 11 Oct 2011 16:02:39 +0200

This keeps the definition on IA64 and all the other architectures in sync with
the declaration of _UPTi_find_unwind_table. This also mimics the behaviour of
what's done for local unwinding and allows the function to provide more than
one way to undwind.

Signed-off-by: Ken Werner <address@hidden>
---
 src/ptrace/_UPT_find_proc_info.c         |    8 ++++----
 src/ptrace/_UPT_get_dyn_info_list_addr.c |    6 ++----
 src/ptrace/_UPT_internal.h               |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c
index 44feb34..7aaa0c2 100644
--- a/src/ptrace/_UPT_find_proc_info.c
+++ b/src/ptrace/_UPT_find_proc_info.c
@@ -95,7 +95,7 @@ find_gp (struct UPT_info *ui, Elf64_Phdr *pdyn, Elf64_Addr 
load_base)
   return gp;
 }
 
-HIDDEN unw_dyn_info_t *
+HIDDEN int
 _UPTi_find_unwind_table (struct UPT_info *ui, unw_addr_space_t as,
                         char *path, unw_word_t segbase, unw_word_t mapoff,
                         unw_word_t ip)
@@ -105,7 +105,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, 
unw_addr_space_t as,
   int i;
 
   if (!_Uelf64_valid_object (&ui->ei))
-    return NULL;
+    return -UNW_ENOINFO;
 
   ehdr = ui->ei.image;
   phdr = (Elf64_Phdr *) ((char *) ui->ei.image + ehdr->e_phoff);
@@ -132,7 +132,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, 
unw_addr_space_t as,
        }
     }
   if (!ptxt || !punw)
-    return NULL;
+    return 0;
 
   ui->di_cache.start_ip = segbase;
   ui->di_cache.end_ip = ui->di_cache.start_ip + ptxt->p_memsz;
@@ -143,7 +143,7 @@ _UPTi_find_unwind_table (struct UPT_info *ui, 
unw_addr_space_t as,
   ui->di_cache.u.ti.table_len = punw->p_memsz / sizeof (unw_word_t);
   ui->di_cache.u.ti.table_data = (unw_word_t *)
     ((char *) ui->ei.image + (punw->p_vaddr - ptxt->p_vaddr));
-  return &ui->di_cache;
+  return 1;
 }
 
 #elif UNW_TARGET_X86 || UNW_TARGET_X86_64 || UNW_TARGET_HPPA \
diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c 
b/src/ptrace/_UPT_get_dyn_info_list_addr.c
index ba9c795..fdcf56d 100644
--- a/src/ptrace/_UPT_get_dyn_info_list_addr.c
+++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c
@@ -37,7 +37,6 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, 
void *arg,
   struct UPT_info *ui = arg;
   struct map_iterator mi;
   char path[PATH_MAX];
-  unw_dyn_info_t *di;
   unw_word_t res;
   int count = 0;
 
@@ -62,10 +61,9 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, 
void *arg,
 
       Debug (16, "checking object %s\n", path);
 
-      di = _UPTi_find_unwind_table (ui, as, path, lo, off, 0);
-      if (di)
+      if (_UPTi_find_unwind_table (ui, as, path, lo, off, 0) > 0)
        {
-         res = _Uia64_find_dyn_list (as, di, arg);
+         res = _Uia64_find_dyn_list (as, &ui->di_cache, arg);
          if (res && count++ == 0)
            {
              Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res);
diff --git a/src/ptrace/_UPT_internal.h b/src/ptrace/_UPT_internal.h
index 52cc88c..a7a0481 100644
--- a/src/ptrace/_UPT_internal.h
+++ b/src/ptrace/_UPT_internal.h
@@ -64,7 +64,7 @@ struct UPT_info
 
 extern int _UPT_reg_offset[UNW_REG_LAST + 1];
 
-extern unw_dyn_info_t *UPTi_find_unwind_table (struct UPT_info *ui,
+extern int _UPTi_find_unwind_table (struct UPT_info *ui,
                                    unw_addr_space_t as,
                                    char *path,
                                    unw_word_t segbase,
-- 
1.7.4.1




reply via email to

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