mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 03:53:43 +01:00
Move ret_addr_column and signal_frame from dwarf_reg_state to
dwarf_reg_cache_entry, leaving in dwarf_reg_state only what apply_reg_state needs.
This commit is contained in:
parent
a7c65f5c3e
commit
fef5de6c45
14 changed files with 41 additions and 44 deletions
|
@ -259,8 +259,6 @@ dwarf_save_loc_t;
|
||||||
typedef struct dwarf_reg_state
|
typedef struct dwarf_reg_state
|
||||||
{
|
{
|
||||||
dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2];
|
dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2];
|
||||||
unw_word_t ret_addr_column; /* indicates which column in the rule table represents return address */
|
|
||||||
unsigned short signal_frame : 1; /* optional machine-dependent signal info */
|
|
||||||
}
|
}
|
||||||
dwarf_reg_state_t;
|
dwarf_reg_state_t;
|
||||||
|
|
||||||
|
@ -277,7 +275,9 @@ typedef struct dwarf_reg_cache_entry
|
||||||
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) */
|
||||||
|
unw_word_t ret_addr_column; /* indicates which column in the rule table represents return address */
|
||||||
unsigned short valid : 1; /* 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_cache_entry_t;
|
dwarf_reg_cache_entry_t;
|
||||||
|
|
||||||
|
|
|
@ -273,8 +273,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
|
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
|
||||||
#define tdep_trace UNW_OBJ(tdep_trace)
|
#define tdep_trace UNW_OBJ(tdep_trace)
|
||||||
|
|
||||||
|
|
|
@ -261,8 +261,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
|
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
|
||||||
#define tdep_trace UNW_OBJ(tdep_trace)
|
#define tdep_trace UNW_OBJ(tdep_trace)
|
||||||
|
|
||||||
|
|
|
@ -236,8 +236,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
|
|
||||||
|
|
|
@ -230,8 +230,8 @@ struct ia64_global_unwind_state
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
#define tdep_get_as(c) ((c)->as)
|
#define tdep_get_as(c) ((c)->as)
|
||||||
|
|
|
@ -289,8 +289,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
#define tdep_get_func_addr UNW_OBJ(get_func_addr)
|
#define tdep_get_func_addr UNW_OBJ(get_func_addr)
|
||||||
|
|
|
@ -319,8 +319,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
#define tdep_get_func_addr UNW_OBJ(get_func_addr)
|
#define tdep_get_func_addr UNW_OBJ(get_func_addr)
|
||||||
|
|
|
@ -237,8 +237,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
|
|
||||||
|
|
|
@ -216,8 +216,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
|
|
||||||
|
|
|
@ -250,8 +250,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
#define tdep_access_reg UNW_OBJ(access_reg)
|
#define tdep_access_reg UNW_OBJ(access_reg)
|
||||||
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
|
||||||
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
#define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
#define tdep_cache_frame(c,rs) do {} while(0)
|
#define tdep_cache_frame(c) 0
|
||||||
#define tdep_reuse_frame(c,rs) do {} while(0)
|
#define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#define tdep_stash_frame(c,rs) do {} while(0)
|
#define tdep_stash_frame(c,rs) do {} while(0)
|
||||||
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
|
||||||
|
|
||||||
|
|
|
@ -206,8 +206,8 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
|
||||||
# define tdep_reuse_frame UNW_OBJ(reuse_frame)
|
# define tdep_reuse_frame UNW_OBJ(reuse_frame)
|
||||||
#else
|
#else
|
||||||
# define tdep_fetch_frame(c,ip,n) do {} while(0)
|
# define tdep_fetch_frame(c,ip,n) do {} while(0)
|
||||||
# define tdep_cache_frame(c,rs) do {} while(0)
|
# define tdep_cache_frame(c) 0
|
||||||
# define tdep_reuse_frame(c,rs) do {} while(0)
|
# define tdep_reuse_frame(c,frame) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
#define tdep_stash_frame UNW_OBJ(stash_frame)
|
#define tdep_stash_frame UNW_OBJ(stash_frame)
|
||||||
#define tdep_trace UNW_OBJ(tdep_trace)
|
#define tdep_trace UNW_OBJ(tdep_trace)
|
||||||
|
@ -251,10 +251,9 @@ extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg,
|
||||||
#if __linux__
|
#if __linux__
|
||||||
extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip,
|
extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip,
|
||||||
int need_unwind_info);
|
int need_unwind_info);
|
||||||
extern void tdep_cache_frame (struct dwarf_cursor *c,
|
extern int tdep_cache_frame (struct dwarf_cursor *c);
|
||||||
struct dwarf_reg_state *rs);
|
|
||||||
extern void tdep_reuse_frame (struct dwarf_cursor *c,
|
extern void tdep_reuse_frame (struct dwarf_cursor *c,
|
||||||
struct dwarf_reg_state *rs);
|
int frame);
|
||||||
extern void tdep_stash_frame (struct dwarf_cursor *c,
|
extern void tdep_stash_frame (struct dwarf_cursor *c,
|
||||||
struct dwarf_reg_state *rs);
|
struct dwarf_reg_state *rs);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -668,7 +668,6 @@ 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, struct dwarf_cursor * c)
|
rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
|
||||||
{
|
{
|
||||||
dwarf_reg_state_t *rs;
|
|
||||||
unw_hash_index_t index;
|
unw_hash_index_t index;
|
||||||
unsigned short head;
|
unsigned short head;
|
||||||
|
|
||||||
|
@ -702,12 +701,9 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
|
||||||
|
|
||||||
cache->links[head].ip = c->ip;
|
cache->links[head].ip = c->ip;
|
||||||
cache->links[head].valid = 1;
|
cache->links[head].valid = 1;
|
||||||
rs = cache->buckets + head;
|
cache->links[head].ret_addr_column = c->ret_addr_column;
|
||||||
rs->ret_addr_column = c->ret_addr_column;
|
cache->links[head].signal_frame = tdep_cache_frame(c);
|
||||||
rs->signal_frame = 0;
|
return cache->buckets + head;
|
||||||
tdep_cache_frame (c, rs);
|
|
||||||
|
|
||||||
return rs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -887,8 +883,9 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
|
||||||
(rs = rs_lookup(cache, c)))
|
(rs = rs_lookup(cache, c)))
|
||||||
{
|
{
|
||||||
/* update hint; no locking needed: single-word writes are atomic */
|
/* update hint; no locking needed: single-word writes are atomic */
|
||||||
c->ret_addr_column = rs->ret_addr_column;
|
unsigned short index = rs - cache->buckets;
|
||||||
c->use_prev_instr = ! rs->signal_frame;
|
c->ret_addr_column = cache->links[index].ret_addr_column;
|
||||||
|
c->use_prev_instr = ! cache->links[index].signal_frame;
|
||||||
memcpy (&sr->rs_current, rs, sizeof (*rs));
|
memcpy (&sr->rs_current, rs, sizeof (*rs));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -902,16 +899,17 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
|
||||||
{
|
{
|
||||||
rs = rs_new (cache, c);
|
rs = rs_new (cache, c);
|
||||||
cache->links[rs - cache->buckets].hint = 0;
|
cache->links[rs - cache->buckets].hint = 0;
|
||||||
memcpy(rs, &sr->rs_current, offsetof(struct dwarf_reg_state, ret_addr_column));
|
memcpy(rs, &sr->rs_current, sizeof(*rs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned short index = -1;
|
||||||
if (cache)
|
if (cache)
|
||||||
{
|
{
|
||||||
put_rs_cache (c->as, cache, &saved_mask);
|
put_rs_cache (c->as, cache, &saved_mask);
|
||||||
if (rs)
|
if (rs)
|
||||||
{
|
{
|
||||||
unsigned short index = rs - cache->buckets;
|
index = rs - cache->buckets;
|
||||||
c->hint = cache->links[index].hint;
|
c->hint = cache->links[index].hint;
|
||||||
cache->links[c->prev_rs].hint = index + 1;
|
cache->links[c->prev_rs].hint = index + 1;
|
||||||
c->prev_rs = index;
|
c->prev_rs = index;
|
||||||
|
@ -920,7 +918,7 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (cache)
|
if (cache)
|
||||||
tdep_reuse_frame (c, rs);
|
tdep_reuse_frame (c, cache->links[index].signal_frame);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,21 +47,21 @@ tdep_fetch_frame (struct dwarf_cursor *dw, unw_word_t ip, int need_unwind_info)
|
||||||
dw->ip, dw->cfa, c->sigcontext_format);
|
dw->ip, dw->cfa, c->sigcontext_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN void
|
HIDDEN int
|
||||||
tdep_cache_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs)
|
tdep_cache_frame (struct dwarf_cursor *dw)
|
||||||
{
|
{
|
||||||
struct cursor *c = (struct cursor *) dw;
|
struct cursor *c = (struct cursor *) dw;
|
||||||
rs->signal_frame = c->sigcontext_format;
|
|
||||||
|
|
||||||
Debug(5, "cache frame ip=0x%lx cfa=0x%lx format=%d\n",
|
Debug(5, "cache frame ip=0x%lx cfa=0x%lx format=%d\n",
|
||||||
dw->ip, dw->cfa, c->sigcontext_format);
|
dw->ip, dw->cfa, c->sigcontext_format);
|
||||||
|
return c->sigcontext_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN void
|
HIDDEN void
|
||||||
tdep_reuse_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs)
|
tdep_reuse_frame (struct dwarf_cursor *dw, int frame)
|
||||||
{
|
{
|
||||||
struct cursor *c = (struct cursor *) dw;
|
struct cursor *c = (struct cursor *) dw;
|
||||||
c->sigcontext_format = rs->signal_frame;
|
c->sigcontext_format = frame;
|
||||||
if (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME)
|
if (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME)
|
||||||
{
|
{
|
||||||
c->frame_info.frame_type = UNW_X86_64_FRAME_SIGRETURN;
|
c->frame_info.frame_type = UNW_X86_64_FRAME_SIGRETURN;
|
||||||
|
|
Loading…
Reference in a new issue