1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-22 19:43:42 +01:00

Change address type from void* to unw_word_t.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
This commit is contained in:
Ken Werner 2011-07-06 19:15:09 +00:00
parent 264b101905
commit 25f6b8295d
4 changed files with 20 additions and 20 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;

View file

@ -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;