1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-22 19:43:42 +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:
Doug Moore 2017-05-10 21:26:02 -05:00
parent a7c65f5c3e
commit fef5de6c45
14 changed files with 41 additions and 44 deletions

View file

@ -259,8 +259,6 @@ dwarf_save_loc_t;
typedef struct dwarf_reg_state
{
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;
@ -277,7 +275,9 @@ typedef struct dwarf_reg_cache_entry
unsigned short lru_chain; /* used for least-recently-used chain */
unsigned short coll_chain; /* used for hash collisions */
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 signal_frame : 1; /* optional machine-dependent signal info */
}
dwarf_reg_cache_entry_t;

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
#define tdep_trace UNW_OBJ(tdep_trace)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame UNW_OBJ(tdep_stash_frame)
#define tdep_trace UNW_OBJ(tdep_trace)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)

View file

@ -230,8 +230,8 @@ struct ia64_global_unwind_state
#define tdep_access_reg UNW_OBJ(access_reg)
#define tdep_access_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
#define tdep_get_as(c) ((c)->as)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
#define tdep_get_func_addr UNW_OBJ(get_func_addr)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
#define tdep_get_func_addr UNW_OBJ(get_func_addr)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)

View file

@ -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_fpreg UNW_OBJ(access_fpreg)
#define tdep_fetch_frame(c,ip,n) do {} while(0)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_cache_frame(c) 0
#define tdep_reuse_frame(c,frame) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)

View file

@ -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)
#else
# define tdep_fetch_frame(c,ip,n) do {} while(0)
# define tdep_cache_frame(c,rs) do {} while(0)
# define tdep_reuse_frame(c,rs) do {} while(0)
# define tdep_cache_frame(c) 0
# define tdep_reuse_frame(c,frame) do {} while(0)
#endif
#define tdep_stash_frame UNW_OBJ(stash_frame)
#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__
extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip,
int need_unwind_info);
extern void tdep_cache_frame (struct dwarf_cursor *c,
struct dwarf_reg_state *rs);
extern int tdep_cache_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,
struct dwarf_reg_state *rs);
#endif

View file

@ -668,7 +668,6 @@ rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
static inline dwarf_reg_state_t *
rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
{
dwarf_reg_state_t *rs;
unw_hash_index_t index;
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].valid = 1;
rs = cache->buckets + head;
rs->ret_addr_column = c->ret_addr_column;
rs->signal_frame = 0;
tdep_cache_frame (c, rs);
return rs;
cache->links[head].ret_addr_column = c->ret_addr_column;
cache->links[head].signal_frame = tdep_cache_frame(c);
return cache->buckets + head;
}
static int
@ -887,8 +883,9 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
(rs = rs_lookup(cache, c)))
{
/* update hint; no locking needed: single-word writes are atomic */
c->ret_addr_column = rs->ret_addr_column;
c->use_prev_instr = ! rs->signal_frame;
unsigned short index = rs - cache->buckets;
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));
}
else
@ -902,16 +899,17 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
rs = rs_new (cache, c);
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)
{
put_rs_cache (c->as, cache, &saved_mask);
if (rs)
{
unsigned short index = rs - cache->buckets;
index = rs - cache->buckets;
c->hint = cache->links[index].hint;
cache->links[c->prev_rs].hint = index + 1;
c->prev_rs = index;
@ -920,7 +918,7 @@ find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
if (ret < 0)
return ret;
if (cache)
tdep_reuse_frame (c, rs);
tdep_reuse_frame (c, cache->links[index].signal_frame);
return 0;
}

View file

@ -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);
}
HIDDEN void
tdep_cache_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs)
HIDDEN int
tdep_cache_frame (struct dwarf_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",
dw->ip, dw->cfa, c->sigcontext_format);
return c->sigcontext_format;
}
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;
c->sigcontext_format = rs->signal_frame;
c->sigcontext_format = frame;
if (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME)
{
c->frame_info.frame_type = UNW_X86_64_FRAME_SIGRETURN;