1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-14 12:18:12 +01:00

Change dwarf_reg_state from an array of pairs of differently-sized objects

to a pair of arrays, to reduce internal fragmentation.  Reduces storage
use by 37.5% on x86_64.
This commit is contained in:
Doug Moore 2017-05-16 17:40:58 -05:00
parent 2b692db23f
commit 028a60f064
5 changed files with 118 additions and 124 deletions

View file

@ -236,13 +236,6 @@ typedef enum
} }
dwarf_where_t; dwarf_where_t;
typedef struct
{
dwarf_where_t where; /* how is the register saved? */
unw_word_t val; /* where it's saved */
}
dwarf_save_loc_t;
/* For uniformity, we'd like to treat the CFA save-location like any /* For uniformity, we'd like to treat the CFA save-location like any
other register save-location, but this doesn't quite work, because other register save-location, but this doesn't quite work, because
the CFA can be expressed as a (REGISTER,OFFSET) pair. To handle the CFA can be expressed as a (REGISTER,OFFSET) pair. To handle
@ -258,7 +251,8 @@ dwarf_save_loc_t;
typedef struct dwarf_reg_state typedef struct dwarf_reg_state
{ {
dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2]; char where[DWARF_NUM_PRESERVED_REGS + 2]; /* how is the register saved? */
unw_word_t val[DWARF_NUM_PRESERVED_REGS + 2]; /* where it's saved */
} }
dwarf_reg_state_t; dwarf_reg_state_t;

View file

@ -36,13 +36,13 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
" ra=0x%lx fp [where=%d val=%ld @0x%lx] lr [where=%d val=%ld @0x%lx] " " ra=0x%lx fp [where=%d val=%ld @0x%lx] lr [where=%d val=%ld @0x%lx] "
"sp [where=%d val=%ld @0x%lx]\n", "sp [where=%d val=%ld @0x%lx]\n",
d->ip, d->cfa, f->frame_type, d->ip, d->cfa, f->frame_type,
rs->reg[DWARF_CFA_REG_COLUMN].where, rs->where[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_REG_COLUMN].val, rs->val[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_OFF_COLUMN].val, rs->val[DWARF_CFA_OFF_COLUMN],
DWARF_GET_LOC(d->loc[d->ret_addr_column]), DWARF_GET_LOC(d->loc[d->ret_addr_column]),
rs->reg[FP].where, rs->reg[FP].val, DWARF_GET_LOC(d->loc[FP]), rs->where[FP], rs->val[FP], DWARF_GET_LOC(d->loc[FP]),
rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), rs->where[LR], rs->val[LR], DWARF_GET_LOC(d->loc[LR]),
rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); rs->where[SP], rs->val[SP], DWARF_GET_LOC(d->loc[SP]));
/* A standard frame is defined as: /* A standard frame is defined as:
- CFA is register-relative offset off FP or SP; - CFA is register-relative offset off FP or SP;
@ -51,37 +51,37 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
- LR is unsaved or saved at CFA+offset, offset != -1; - LR is unsaved or saved at CFA+offset, offset != -1;
- SP is unsaved or saved at CFA+offset, offset != -1. */ - SP is unsaved or saved at CFA+offset, offset != -1. */
if (f->frame_type == UNW_AARCH64_FRAME_OTHER if (f->frame_type == UNW_AARCH64_FRAME_OTHER
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == FP && (rs->val[DWARF_CFA_REG_COLUMN] == FP
|| rs->reg[DWARF_CFA_REG_COLUMN].val == SP) || rs->val[DWARF_CFA_REG_COLUMN] == SP)
&& labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29) && labs(rs->val[DWARF_CFA_OFF_COLUMN]) < (1 << 29)
&& d->ret_addr_column == LR && d->ret_addr_column == LR
&& (rs->reg[FP].where == DWARF_WHERE_UNDEF && (rs->where[FP] == DWARF_WHERE_UNDEF
|| rs->reg[FP].where == DWARF_WHERE_SAME || rs->where[FP] == DWARF_WHERE_SAME
|| (rs->reg[FP].where == DWARF_WHERE_CFAREL || (rs->where[FP] == DWARF_WHERE_CFAREL
&& labs(rs->reg[FP].val) < (1 << 29) && labs(rs->val[FP]) < (1 << 29)
&& rs->reg[FP].val+1 != 0)) && rs->val[FP]+1 != 0))
&& (rs->reg[LR].where == DWARF_WHERE_UNDEF && (rs->where[LR] == DWARF_WHERE_UNDEF
|| rs->reg[LR].where == DWARF_WHERE_SAME || rs->where[LR] == DWARF_WHERE_SAME
|| (rs->reg[LR].where == DWARF_WHERE_CFAREL || (rs->where[LR] == DWARF_WHERE_CFAREL
&& labs(rs->reg[LR].val) < (1 << 29) && labs(rs->val[LR]) < (1 << 29)
&& rs->reg[LR].val+1 != 0)) && rs->val[LR]+1 != 0))
&& (rs->reg[SP].where == DWARF_WHERE_UNDEF && (rs->where[SP] == DWARF_WHERE_UNDEF
|| rs->reg[SP].where == DWARF_WHERE_SAME || rs->where[SP] == DWARF_WHERE_SAME
|| (rs->reg[SP].where == DWARF_WHERE_CFAREL || (rs->where[SP] == DWARF_WHERE_CFAREL
&& labs(rs->reg[SP].val) < (1 << 29) && labs(rs->val[SP]) < (1 << 29)
&& rs->reg[SP].val+1 != 0))) && rs->val[SP]+1 != 0)))
{ {
/* Save information for a standard frame. */ /* Save information for a standard frame. */
f->frame_type = UNW_AARCH64_FRAME_STANDARD; f->frame_type = UNW_AARCH64_FRAME_STANDARD;
f->cfa_reg_sp = (rs->reg[DWARF_CFA_REG_COLUMN].val == SP); f->cfa_reg_sp = (rs->val[DWARF_CFA_REG_COLUMN] == SP);
f->cfa_reg_offset = rs->reg[DWARF_CFA_OFF_COLUMN].val; f->cfa_reg_offset = rs->val[DWARF_CFA_OFF_COLUMN];
if (rs->reg[FP].where == DWARF_WHERE_CFAREL) if (rs->where[FP] == DWARF_WHERE_CFAREL)
f->fp_cfa_offset = rs->reg[FP].val; f->fp_cfa_offset = rs->val[FP];
if (rs->reg[LR].where == DWARF_WHERE_CFAREL) if (rs->where[LR] == DWARF_WHERE_CFAREL)
f->lr_cfa_offset = rs->reg[LR].val; f->lr_cfa_offset = rs->val[LR];
if (rs->reg[SP].where == DWARF_WHERE_CFAREL) if (rs->where[SP] == DWARF_WHERE_CFAREL)
f->sp_cfa_offset = rs->reg[SP].val; f->sp_cfa_offset = rs->val[SP];
Debug (4, " standard frame\n"); Debug (4, " standard frame\n");
} }
else else

View file

@ -36,13 +36,13 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
" ra=0x%x r7 [where=%d val=%d @0x%x] lr [where=%d val=%d @0x%x] " " ra=0x%x r7 [where=%d val=%d @0x%x] lr [where=%d val=%d @0x%x] "
"sp [where=%d val=%d @0x%x]\n", "sp [where=%d val=%d @0x%x]\n",
d->ip, d->cfa, f->frame_type, d->ip, d->cfa, f->frame_type,
rs->reg[DWARF_CFA_REG_COLUMN].where, rs->where[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_REG_COLUMN].val, rs->val[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_OFF_COLUMN].val, rs->val[DWARF_CFA_OFF_COLUMN],
DWARF_GET_LOC(d->loc[d->ret_addr_column]), DWARF_GET_LOC(d->loc[d->ret_addr_column]),
rs->reg[R7].where, rs->reg[R7].val, DWARF_GET_LOC(d->loc[R7]), rs->where[R7], rs->val[R7], DWARF_GET_LOC(d->loc[R7]),
rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), rs->where[LR], rs->val[LR], DWARF_GET_LOC(d->loc[LR]),
rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); rs->where[SP], rs->val[SP], DWARF_GET_LOC(d->loc[SP]));
/* A standard frame is defined as: /* A standard frame is defined as:
- CFA is register-relative offset off R7 or SP; - CFA is register-relative offset off R7 or SP;
@ -51,37 +51,37 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
- LR is unsaved or saved at CFA+offset, offset != -1; - LR is unsaved or saved at CFA+offset, offset != -1;
- SP is unsaved or saved at CFA+offset, offset != -1. */ - SP is unsaved or saved at CFA+offset, offset != -1. */
if (f->frame_type == UNW_ARM_FRAME_OTHER if (f->frame_type == UNW_ARM_FRAME_OTHER
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == R7 && (rs->val[DWARF_CFA_REG_COLUMN] == R7
|| rs->reg[DWARF_CFA_REG_COLUMN].val == SP) || rs->val[DWARF_CFA_REG_COLUMN] == SP)
&& labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29) && labs(rs->val[DWARF_CFA_OFF_COLUMN]) < (1 << 29)
&& d->ret_addr_column == LR && d->ret_addr_column == LR
&& (rs->reg[R7].where == DWARF_WHERE_UNDEF && (rs->where[R7] == DWARF_WHERE_UNDEF
|| rs->reg[R7].where == DWARF_WHERE_SAME || rs->where[R7] == DWARF_WHERE_SAME
|| (rs->reg[R7].where == DWARF_WHERE_CFAREL || (rs->where[R7] == DWARF_WHERE_CFAREL
&& labs(rs->reg[R7].val) < (1 << 29) && labs(rs->val[R7]) < (1 << 29)
&& rs->reg[R7].val+1 != 0)) && rs->val[R7]+1 != 0))
&& (rs->reg[LR].where == DWARF_WHERE_UNDEF && (rs->where[LR] == DWARF_WHERE_UNDEF
|| rs->reg[LR].where == DWARF_WHERE_SAME || rs->where[LR] == DWARF_WHERE_SAME
|| (rs->reg[LR].where == DWARF_WHERE_CFAREL || (rs->where[LR] == DWARF_WHERE_CFAREL
&& labs(rs->reg[LR].val) < (1 << 29) && labs(rs->val[LR]) < (1 << 29)
&& rs->reg[LR].val+1 != 0)) && rs->val[LR]+1 != 0))
&& (rs->reg[SP].where == DWARF_WHERE_UNDEF && (rs->where[SP] == DWARF_WHERE_UNDEF
|| rs->reg[SP].where == DWARF_WHERE_SAME || rs->where[SP] == DWARF_WHERE_SAME
|| (rs->reg[SP].where == DWARF_WHERE_CFAREL || (rs->where[SP] == DWARF_WHERE_CFAREL
&& labs(rs->reg[SP].val) < (1 << 29) && labs(rs->val[SP]) < (1 << 29)
&& rs->reg[SP].val+1 != 0))) && rs->val[SP]+1 != 0)))
{ {
/* Save information for a standard frame. */ /* Save information for a standard frame. */
f->frame_type = UNW_ARM_FRAME_STANDARD; f->frame_type = UNW_ARM_FRAME_STANDARD;
f->cfa_reg_sp = (rs->reg[DWARF_CFA_REG_COLUMN].val == SP); f->cfa_reg_sp = (rs->val[DWARF_CFA_REG_COLUMN] == SP);
f->cfa_reg_offset = rs->reg[DWARF_CFA_OFF_COLUMN].val; f->cfa_reg_offset = rs->val[DWARF_CFA_OFF_COLUMN];
if (rs->reg[R7].where == DWARF_WHERE_CFAREL) if (rs->where[R7] == DWARF_WHERE_CFAREL)
f->r7_cfa_offset = rs->reg[R7].val; f->r7_cfa_offset = rs->val[R7];
if (rs->reg[LR].where == DWARF_WHERE_CFAREL) if (rs->where[LR] == DWARF_WHERE_CFAREL)
f->lr_cfa_offset = rs->reg[LR].val; f->lr_cfa_offset = rs->val[LR];
if (rs->reg[SP].where == DWARF_WHERE_CFAREL) if (rs->where[SP] == DWARF_WHERE_CFAREL)
f->sp_cfa_offset = rs->reg[SP].val; f->sp_cfa_offset = rs->val[SP];
Debug (4, " standard frame\n"); Debug (4, " standard frame\n");
} }
else else

View file

@ -55,8 +55,8 @@ static inline void
set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where, set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where,
unw_word_t val) unw_word_t val)
{ {
sr->rs_current.reg[regnum].where = where; sr->rs_current.where[regnum] = where;
sr->rs_current.reg[regnum].val = val; sr->rs_current.val[regnum] = val;
} }
static inline int static inline int
@ -218,7 +218,8 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
ret = -UNW_EINVAL; ret = -UNW_EINVAL;
break; break;
} }
sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; sr->rs_current.where[regnum] = sr->rs_initial.where[regnum];
sr->rs_current.val[regnum] = sr->rs_initial.val[regnum];
Debug (15, "CFA_restore r%lu\n", (long) regnum); Debug (15, "CFA_restore r%lu\n", (long) regnum);
break; break;
@ -232,7 +233,8 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
ret = -UNW_EINVAL; ret = -UNW_EINVAL;
break; break;
} }
sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; sr->rs_current.where[regnum] = sr->rs_initial.where[regnum];
sr->rs_current.val[regnum] = sr->rs_initial.val[regnum];
Debug (15, "CFA_restore_extended r%lu\n", (long) regnum); Debug (15, "CFA_restore_extended r%lu\n", (long) regnum);
break; break;
@ -276,8 +278,7 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
ret = -UNW_ENOMEM; ret = -UNW_ENOMEM;
break; break;
} }
memcpy ((*rs_stack)->state.reg, sr->rs_current.reg, memcpy (&(*rs_stack)->state, &sr->rs_current, sizeof (sr->rs_current))
sizeof (dwarf_reg_state_t))
Debug (15, "CFA_remember_state\n"); Debug (15, "CFA_remember_state\n");
break; break;
@ -288,8 +289,7 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
ret = -UNW_EINVAL; ret = -UNW_EINVAL;
break; break;
} }
memcpy (&sr->rs_current.reg, &(*rs_stack)->state.reg, memcpy (&sr->rs_current, &(*rs_stack)->state, sizeof (sr->rs_current));
sizeof (dwarf_reg_state_t));
pop_rstate_stack(rs_stack); pop_rstate_stack(rs_stack);
Debug (15, "CFA_restore_state\n"); Debug (15, "CFA_restore_state\n");
break; break;
@ -790,32 +790,32 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
/* Evaluate the CFA first, because it may be referred to by other /* Evaluate the CFA first, because it may be referred to by other
expressions. */ expressions. */
if (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) if (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
{ {
/* CFA is equal to [reg] + offset: */ /* CFA is equal to [reg] + offset: */
/* As a special-case, if the stack-pointer is the CFA and the /* As a special-case, if the stack-pointer is the CFA and the
stack-pointer wasn't saved, popping the CFA implicitly pops stack-pointer wasn't saved, popping the CFA implicitly pops
the stack-pointer as well. */ the stack-pointer as well. */
if ((rs->reg[DWARF_CFA_REG_COLUMN].val == UNW_TDEP_SP) if ((rs->val[DWARF_CFA_REG_COLUMN] == UNW_TDEP_SP)
&& (UNW_TDEP_SP < ARRAY_SIZE(rs->reg)) && (UNW_TDEP_SP < ARRAY_SIZE(rs->val))
&& (rs->reg[UNW_TDEP_SP].where == DWARF_WHERE_SAME)) && (rs->where[UNW_TDEP_SP] == DWARF_WHERE_SAME))
cfa = c->cfa; cfa = c->cfa;
else else
{ {
regnum = dwarf_to_unw_regnum (rs->reg[DWARF_CFA_REG_COLUMN].val); regnum = dwarf_to_unw_regnum (rs->val[DWARF_CFA_REG_COLUMN]);
if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0) if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0)
return ret; return ret;
} }
cfa += rs->reg[DWARF_CFA_OFF_COLUMN].val; cfa += rs->val[DWARF_CFA_OFF_COLUMN];
} }
else else
{ {
/* CFA is equal to EXPR: */ /* CFA is equal to EXPR: */
assert (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_EXPR); assert (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR);
addr = rs->reg[DWARF_CFA_REG_COLUMN].val; addr = rs->val[DWARF_CFA_REG_COLUMN];
if ((ret = eval_location_expr (c, as, a, addr, &cfa_loc, arg)) < 0) if ((ret = eval_location_expr (c, as, a, addr, &cfa_loc, arg)) < 0)
return ret; return ret;
/* the returned location better be a memory location... */ /* the returned location better be a memory location... */
@ -826,7 +826,7 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
{ {
switch ((dwarf_where_t) rs->reg[i].where) switch ((dwarf_where_t) rs->where[i])
{ {
case DWARF_WHERE_UNDEF: case DWARF_WHERE_UNDEF:
c->loc[i] = DWARF_NULL_LOC; c->loc[i] = DWARF_NULL_LOC;
@ -836,21 +836,21 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
break; break;
case DWARF_WHERE_CFAREL: case DWARF_WHERE_CFAREL:
c->loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg[i].val); c->loc[i] = DWARF_MEM_LOC (c, cfa + rs->val[i]);
break; break;
case DWARF_WHERE_REG: case DWARF_WHERE_REG:
c->loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->reg[i].val)); c->loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->val[i]));
break; break;
case DWARF_WHERE_EXPR: case DWARF_WHERE_EXPR:
addr = rs->reg[i].val; addr = rs->val[i];
if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0) if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0)
return ret; return ret;
break; break;
case DWARF_WHERE_VAL_EXPR: case DWARF_WHERE_VAL_EXPR:
addr = rs->reg[i].val; addr = rs->val[i];
if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0) if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0)
return ret; return ret;
c->loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (c->loc[i])); c->loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (c->loc[i]));

View file

@ -34,20 +34,20 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld" Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld"
" ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n", " ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n",
d->ip, d->cfa, f->frame_type, d->ip, d->cfa, f->frame_type,
rs->reg[DWARF_CFA_REG_COLUMN].where, rs->where[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_REG_COLUMN].val, rs->val[DWARF_CFA_REG_COLUMN],
rs->reg[DWARF_CFA_OFF_COLUMN].val, rs->val[DWARF_CFA_OFF_COLUMN],
DWARF_GET_LOC(d->loc[d->ret_addr_column]), DWARF_GET_LOC(d->loc[d->ret_addr_column]),
rs->reg[RBP].where, rs->reg[RBP].val, DWARF_GET_LOC(d->loc[RBP]), rs->where[RBP], rs->val[RBP], DWARF_GET_LOC(d->loc[RBP]),
rs->reg[RSP].where, rs->reg[RSP].val, DWARF_GET_LOC(d->loc[RSP])); rs->where[RSP], rs->val[RSP], DWARF_GET_LOC(d->loc[RSP]));
if (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_EXPR && if (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR &&
rs->reg[RBP].where == DWARF_WHERE_EXPR) { rs->where[RBP] == DWARF_WHERE_EXPR) {
/* Check for GCC generated alignment frame for rsp. A simple /* Check for GCC generated alignment frame for rsp. A simple
* def_cfa_expr that loads a constant offset from rbp, where the * def_cfa_expr that loads a constant offset from rbp, where the
* addres of the rip was pushed on the stack */ * addres of the rip was pushed on the stack */
unw_word_t cfa_addr = rs->reg[DWARF_CFA_REG_COLUMN].val; unw_word_t cfa_addr = rs->val[DWARF_CFA_REG_COLUMN];
unw_word_t rbp_addr = rs->reg[RBP].val; unw_word_t rbp_addr = rs->val[RBP];
unw_word_t cfa_offset; unw_word_t cfa_offset;
int ret = dwarf_stack_aligned(d, cfa_addr, rbp_addr, &cfa_offset); int ret = dwarf_stack_aligned(d, cfa_addr, rbp_addr, &cfa_offset);
@ -64,30 +64,30 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs)
- RBP is unsaved or saved at CFA+offset, offset != -1; - RBP is unsaved or saved at CFA+offset, offset != -1;
- RSP is unsaved or saved at CFA+offset, offset != -1. */ - RSP is unsaved or saved at CFA+offset, offset != -1. */
if (f->frame_type == UNW_X86_64_FRAME_OTHER if (f->frame_type == UNW_X86_64_FRAME_OTHER
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP && (rs->val[DWARF_CFA_REG_COLUMN] == RBP
|| rs->reg[DWARF_CFA_REG_COLUMN].val == RSP) || rs->val[DWARF_CFA_REG_COLUMN] == RSP)
&& labs((long) rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 28) && labs((long) rs->val[DWARF_CFA_OFF_COLUMN]) < (1 << 28)
&& DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8 && DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8
&& (rs->reg[RBP].where == DWARF_WHERE_UNDEF && (rs->where[RBP] == DWARF_WHERE_UNDEF
|| rs->reg[RBP].where == DWARF_WHERE_SAME || rs->where[RBP] == DWARF_WHERE_SAME
|| (rs->reg[RBP].where == DWARF_WHERE_CFAREL || (rs->where[RBP] == DWARF_WHERE_CFAREL
&& labs((long) rs->reg[RBP].val) < (1 << 14) && labs((long) rs->val[RBP]) < (1 << 14)
&& rs->reg[RBP].val+1 != 0)) && rs->val[RBP]+1 != 0))
&& (rs->reg[RSP].where == DWARF_WHERE_UNDEF && (rs->where[RSP] == DWARF_WHERE_UNDEF
|| rs->reg[RSP].where == DWARF_WHERE_SAME || rs->where[RSP] == DWARF_WHERE_SAME
|| (rs->reg[RSP].where == DWARF_WHERE_CFAREL || (rs->where[RSP] == DWARF_WHERE_CFAREL
&& labs((long) rs->reg[RSP].val) < (1 << 14) && labs((long) rs->val[RSP]) < (1 << 14)
&& rs->reg[RSP].val+1 != 0))) && rs->val[RSP]+1 != 0)))
{ {
/* Save information for a standard frame. */ /* Save information for a standard frame. */
f->frame_type = UNW_X86_64_FRAME_STANDARD; f->frame_type = UNW_X86_64_FRAME_STANDARD;
f->cfa_reg_rsp = (rs->reg[DWARF_CFA_REG_COLUMN].val == RSP); f->cfa_reg_rsp = (rs->val[DWARF_CFA_REG_COLUMN] == RSP);
f->cfa_reg_offset = rs->reg[DWARF_CFA_OFF_COLUMN].val; f->cfa_reg_offset = rs->val[DWARF_CFA_OFF_COLUMN];
if (rs->reg[RBP].where == DWARF_WHERE_CFAREL) if (rs->where[RBP] == DWARF_WHERE_CFAREL)
f->rbp_cfa_offset = rs->reg[RBP].val; f->rbp_cfa_offset = rs->val[RBP];
if (rs->reg[RSP].where == DWARF_WHERE_CFAREL) if (rs->where[RSP] == DWARF_WHERE_CFAREL)
f->rsp_cfa_offset = rs->reg[RSP].val; f->rsp_cfa_offset = rs->val[RSP];
Debug (4, " standard frame\n"); Debug (4, " standard frame\n");
} }