From c5dc3c150a4fab2962f8d32f78d80ce857e662a5 Mon Sep 17 00:00:00 2001 From: Arun Sharma Date: Wed, 26 Jul 2006 21:29:50 -0600 Subject: [PATCH] [dwarf] Allow return address column to differ from function to function. Signed-off-by: Andrey Veskov Signed-off-by: Arun Sharma --- include/dwarf.h | 1 + src/dwarf/Gparser.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/dwarf.h b/include/dwarf.h index 5360ee38..1c6f776d 100644 --- a/include/dwarf.h +++ b/include/dwarf.h @@ -232,6 +232,7 @@ typedef struct dwarf_reg_state struct dwarf_reg_state *next; /* for rs_stack */ dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2]; 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 coll_chain; /* used for hash collisions */ unsigned short hint; /* hint for next rs to try (or -1) */ diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c index 09e0a843..c4b3a47b 100644 --- a/src/dwarf/Gparser.c +++ b/src/dwarf/Gparser.c @@ -535,7 +535,7 @@ rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c) } 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; 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 */ - index = hash (ip); + index = hash (c->ip); rs->coll_chain = cache->hash[index]; cache->hash[index] = rs - cache->buckets; rs->hint = 0; - rs->ip = ip; + rs->ip = c->ip; + rs->ret_addr_column = c->ret_addr_column; return rs; } @@ -771,7 +772,10 @@ dwarf_find_save_locs (struct dwarf_cursor *c) rs = rs_lookup(cache, c); if (rs) - goto apply; + { + c->ret_addr_column = rs->ret_addr_column; + goto apply; + } if ((ret = fetch_proc_info (c, c->ip, 1)) < 0) return ret; @@ -782,7 +786,7 @@ dwarf_find_save_locs (struct dwarf_cursor *c) rs1 = &sr.rs_current; if (rs1) { - rs = rs_new (cache, c->ip); + rs = rs_new (cache, c); memcpy(rs, rs1, offsetof(struct dwarf_reg_state, ip)); if (!rs) {