mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-01-25 09:40:30 +01:00
[dwarf] Allow return address column to differ from function to function.
Signed-off-by: Andrey Veskov <Andrey.Veskov@intel.com> Signed-off-by: Arun Sharma <arun.sharma@google.com>
This commit is contained in:
parent
60b7af702a
commit
c5dc3c150a
2 changed files with 10 additions and 5 deletions
|
@ -232,6 +232,7 @@ typedef struct dwarf_reg_state
|
||||||
struct dwarf_reg_state *next; /* for rs_stack */
|
struct dwarf_reg_state *next; /* for rs_stack */
|
||||||
dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2];
|
dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2];
|
||||||
unw_word_t ip; /* ip this rs is for */
|
unw_word_t ip; /* ip this rs is for */
|
||||||
|
unw_word_t ret_addr_column; /* indicates which column in the rule table represents return address */
|
||||||
unsigned short lru_chain; /* used for least-recently-used chain */
|
unsigned short lru_chain; /* used for least-recently-used chain */
|
||||||
unsigned short coll_chain; /* used for hash collisions */
|
unsigned short coll_chain; /* used for hash collisions */
|
||||||
unsigned short hint; /* hint for next rs to try (or -1) */
|
unsigned short hint; /* hint for next rs to try (or -1) */
|
||||||
|
|
|
@ -535,7 +535,7 @@ rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline dwarf_reg_state_t *
|
static inline dwarf_reg_state_t *
|
||||||
rs_new (struct dwarf_rs_cache *cache, unw_word_t ip)
|
rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
|
||||||
{
|
{
|
||||||
dwarf_reg_state_t *rs, *prev, *tmp;
|
dwarf_reg_state_t *rs, *prev, *tmp;
|
||||||
unw_hash_index_t index;
|
unw_hash_index_t index;
|
||||||
|
@ -575,12 +575,13 @@ rs_new (struct dwarf_rs_cache *cache, unw_word_t ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enter new rs in the hash table */
|
/* enter new rs in the hash table */
|
||||||
index = hash (ip);
|
index = hash (c->ip);
|
||||||
rs->coll_chain = cache->hash[index];
|
rs->coll_chain = cache->hash[index];
|
||||||
cache->hash[index] = rs - cache->buckets;
|
cache->hash[index] = rs - cache->buckets;
|
||||||
|
|
||||||
rs->hint = 0;
|
rs->hint = 0;
|
||||||
rs->ip = ip;
|
rs->ip = c->ip;
|
||||||
|
rs->ret_addr_column = c->ret_addr_column;
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
@ -771,7 +772,10 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
|
||||||
rs = rs_lookup(cache, c);
|
rs = rs_lookup(cache, c);
|
||||||
|
|
||||||
if (rs)
|
if (rs)
|
||||||
goto apply;
|
{
|
||||||
|
c->ret_addr_column = rs->ret_addr_column;
|
||||||
|
goto apply;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ret = fetch_proc_info (c, c->ip, 1)) < 0)
|
if ((ret = fetch_proc_info (c, c->ip, 1)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -782,7 +786,7 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
|
||||||
rs1 = &sr.rs_current;
|
rs1 = &sr.rs_current;
|
||||||
if (rs1)
|
if (rs1)
|
||||||
{
|
{
|
||||||
rs = rs_new (cache, c->ip);
|
rs = rs_new (cache, c);
|
||||||
memcpy(rs, rs1, offsetof(struct dwarf_reg_state, ip));
|
memcpy(rs, rs1, offsetof(struct dwarf_reg_state, ip));
|
||||||
if (!rs)
|
if (!rs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue