mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-02-16 18:21:41 +01:00
dwarf: introduce a valid bit for dwarf_reg_state_t
Without this, cache_match() returns true when (ip == 0).
This commit is contained in:
parent
d04dc94cc2
commit
5e59e93d04
2 changed files with 5 additions and 2 deletions
|
@ -251,7 +251,8 @@ typedef struct dwarf_reg_state
|
||||||
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) */
|
||||||
unsigned short signal_frame; /* optional machine-dependent signal info */
|
unsigned short valid : 1; /* optional machine-dependent signal info */
|
||||||
|
unsigned short signal_frame : 1; /* optional machine-dependent signal info */
|
||||||
}
|
}
|
||||||
dwarf_reg_state_t;
|
dwarf_reg_state_t;
|
||||||
|
|
||||||
|
|
|
@ -510,6 +510,7 @@ flush_rs_cache (struct dwarf_rs_cache *cache)
|
||||||
cache->buckets[i].lru_chain = (i - 1);
|
cache->buckets[i].lru_chain = (i - 1);
|
||||||
cache->buckets[i].coll_chain = -1;
|
cache->buckets[i].coll_chain = -1;
|
||||||
cache->buckets[i].ip = 0;
|
cache->buckets[i].ip = 0;
|
||||||
|
cache->buckets[i].valid = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i<DWARF_UNW_HASH_SIZE; ++i)
|
for (i = 0; i<DWARF_UNW_HASH_SIZE; ++i)
|
||||||
cache->hash[i] = -1;
|
cache->hash[i] = -1;
|
||||||
|
@ -562,7 +563,7 @@ hash (unw_word_t ip)
|
||||||
static inline long
|
static inline long
|
||||||
cache_match (dwarf_reg_state_t *rs, unw_word_t ip)
|
cache_match (dwarf_reg_state_t *rs, unw_word_t ip)
|
||||||
{
|
{
|
||||||
if (ip == rs->ip)
|
if (rs->valid && (ip == rs->ip))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -646,6 +647,7 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
|
||||||
|
|
||||||
rs->hint = 0;
|
rs->hint = 0;
|
||||||
rs->ip = c->ip;
|
rs->ip = c->ip;
|
||||||
|
rs->valid = 1;
|
||||||
rs->ret_addr_column = c->ret_addr_column;
|
rs->ret_addr_column = c->ret_addr_column;
|
||||||
rs->signal_frame = 0;
|
rs->signal_frame = 0;
|
||||||
tdep_cache_frame (c, rs);
|
tdep_cache_frame (c, rs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue