diff mbox

[2/5] Change address type from void* to unw_word_t.

Message ID 1312373525-20741-3-git-send-email-ken.werner@linaro.org
State Accepted
Commit 25f6b8295d0427746e2a760bb17e63c0461e47f2
Headers show

Commit Message

Ken Werner Aug. 3, 2011, 12:12 p.m. UTC
Signed-off-by: Ken Werner <ken.werner@linaro.org>
---
 include/libunwind-arm.h      |    4 ++--
 include/tdep-arm/ex_tables.h |    4 ++--
 src/arm/Gex_tables.c         |   28 ++++++++++++++--------------
 src/arm/Gstep.c              |    4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)
diff mbox

Patch

diff --git a/include/libunwind-arm.h b/include/libunwind-arm.h
index 0878771..3e7ebf3 100644
--- a/include/libunwind-arm.h
+++ b/include/libunwind-arm.h
@@ -289,8 +289,8 @@  struct arm_exidx_table {
   const char *name;
   struct arm_exidx_entry *start;
   struct arm_exidx_entry *end;
-  void *start_addr;
-  void *end_addr;
+  unw_word_t start_addr;
+  unw_word_t end_addr;
 };
 
 typedef struct
diff --git a/include/tdep-arm/ex_tables.h b/include/tdep-arm/ex_tables.h
index d898619..b5e6dcf 100644
--- a/include/tdep-arm/ex_tables.h
+++ b/include/tdep-arm/ex_tables.h
@@ -55,9 +55,9 @@  struct arm_exbuf_data
 int arm_exidx_init_local (void);
 int arm_exidx_table_add (const char *name, struct arm_exidx_entry *start,
 			 struct arm_exidx_entry *end);
-struct arm_exidx_table *arm_exidx_table_find (void *pc);
+struct arm_exidx_table *arm_exidx_table_find (unw_word_t pc);
 struct arm_exidx_entry *arm_exidx_table_lookup (struct arm_exidx_table *table,
-						void *pc);
+						unw_word_t pc);
 int arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf);
 int arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c);
 int arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c);
diff --git a/src/arm/Gex_tables.c b/src/arm/Gex_tables.c
index 035b24a..b72dabb 100644
--- a/src/arm/Gex_tables.c
+++ b/src/arm/Gex_tables.c
@@ -55,11 +55,11 @@  prel31_read (uint32_t prel31)
   return ((int32_t)prel31 << 1) >> 1;
 }
 
-static inline void *
-prel31_to_addr (void *addr)
+static inline uint32_t
+prel31_to_addr (uint32_t *addr)
 {
-  uint32_t offset = ((long)*(uint32_t *)addr << 1) >> 1;
-  return (char *)addr + offset;
+  uint32_t offset = ((long)*addr << 1) >> 1;
+  return (uint32_t)addr + offset;
 }
 
 static void
@@ -81,7 +81,7 @@  arm_exidx_table_add (const char *name,
   table->start_addr = prel31_to_addr (&start->addr);
   table->end_addr = prel31_to_addr (&(end - 1)->addr);
   Debug (2, "name=%s, range=%p-%p, addr=%p-%p\n",
-      name, start, end, table->start_addr, table->end_addr);
+      name, start, end, (void *)table->start_addr, (void *)table->end_addr);
   return 0;
 }
 
@@ -89,7 +89,7 @@  arm_exidx_table_add (const char *name,
  * Locate the appropriate unwind table from the given PC.
  */
 HIDDEN struct arm_exidx_table *
-arm_exidx_table_find (void *pc)
+arm_exidx_table_find (unw_word_t pc)
 {
   struct arm_exidx_table *table;
   unsigned i;
@@ -106,7 +106,7 @@  arm_exidx_table_find (void *pc)
  * Finds the corresponding arm_exidx_entry from a given index table and PC.
  */
 HIDDEN struct arm_exidx_entry *
-arm_exidx_table_lookup (struct arm_exidx_table *table, void *pc)
+arm_exidx_table_lookup (struct arm_exidx_table *table, unw_word_t pc)
 {
   struct arm_exidx_entry *first = table->start, *last = table->end - 1;
   if (pc < prel31_to_addr (&first->addr))
@@ -339,7 +339,7 @@  HIDDEN int
 arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf)
 {
   int nbuf = 0;
-  uint32_t *addr = prel31_to_addr (&entry->addr);
+  unw_word_t addr = prel31_to_addr (&entry->addr);
 
   uint32_t data = entry->data;
   if (data == ARM_EXIDX_CANT_UNWIND)
@@ -349,20 +349,20 @@  arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf)
     }
   else if (data & ARM_EXIDX_COMPACT)
     {
-      Debug (2, "%p compact model %d [%8.8x]\n", addr, (data >> 24) & 0x7f, data);
+      Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, (data >> 24) & 0x7f, data);
       buf[nbuf++] = data >> 16;
       buf[nbuf++] = data >> 8;
       buf[nbuf++] = data;
     }
   else
     {
-      uint32_t *extbl_data = prel31_to_addr (&entry->data);
-      data = extbl_data[0];
+      uint32_t *extbl_data = (uint32_t *)prel31_to_addr (&entry->data);
+      data = (unw_word_t)extbl_data[0];
       unsigned int n_table_words = 0;
       if (data & ARM_EXIDX_COMPACT)
 	{
 	  int pers = (data >> 24) & 0x0f;
-	  Debug (2, "%p compact model %d [%8.8x]\n", addr, pers, data);
+	  Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data);
 	  if (pers == 1 || pers == 2)
 	    {
 	      n_table_words = (data >> 16) & 0xff;
@@ -375,8 +375,8 @@  arm_exidx_extract (struct arm_exidx_entry *entry, uint8_t *buf)
 	}
       else
 	{
-	  void *pers = prel31_to_addr (extbl_data);
-	  Debug (2, "%p Personality routine: %8p\n", addr, pers);
+	  unw_word_t pers = prel31_to_addr (extbl_data);
+	  Debug (2, "%p Personality routine: %8p\n", (void *)addr, (void *)pers);
 	  n_table_words = extbl_data[1] >> 24;
 	  buf[nbuf++] = extbl_data[1] >> 16;
 	  buf[nbuf++] = extbl_data[1] >> 8;
diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c
index f5fb441..cfe01c0 100644
--- a/src/arm/Gstep.c
+++ b/src/arm/Gstep.c
@@ -46,11 +46,11 @@  arm_exidx_step (struct cursor *c)
   /* mark PC unsaved */
   c->dwarf.loc[UNW_ARM_R15] = DWARF_NULL_LOC;
 
-  table = arm_exidx_table_find ((void *)c->dwarf.ip);
+  table = arm_exidx_table_find (c->dwarf.ip);
   if (NULL == table)
     return -UNW_ENOINFO;
 
-  entry = arm_exidx_table_lookup (table, (void *)c->dwarf.ip);
+  entry = arm_exidx_table_lookup (table, c->dwarf.ip);
   if (NULL == entry)
     return -UNW_ENOINFO;