1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-04-18 02:22:16 +02:00

Have dwarf_step return 0 or 1 for success, according to whether the

previous stack frame was the last, just as unw_step does.  For x86_64,
drop the null check for ret_addr_column, since that check is made already
in apply_reg_state.
This commit is contained in:
Doug Moore 2017-05-19 18:57:14 -05:00
parent f3be411bc8
commit afb2491ccb
2 changed files with 8 additions and 5 deletions
src
dwarf
x86_64

View file

@ -856,13 +856,17 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
c->cfa = cfa; c->cfa = cfa;
/* DWARF spec says undefined return address location means end of stack. */ /* DWARF spec says undefined return address location means end of stack. */
if (DWARF_IS_NULL_LOC (c->loc[rs->ret_addr_column])) if (DWARF_IS_NULL_LOC (c->loc[rs->ret_addr_column]))
{
c->ip = 0; c->ip = 0;
ret = 0;
}
else else
{ {
ret = dwarf_get (c, c->loc[rs->ret_addr_column], &ip); ret = dwarf_get (c, c->loc[rs->ret_addr_column], &ip);
if (ret < 0) if (ret < 0)
return ret; return ret;
c->ip = ip; c->ip = ip;
ret = 1;
} }
/* XXX: check for ip to be code_aligned */ /* XXX: check for ip to be code_aligned */
@ -876,7 +880,7 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
if (c->stash_frames) if (c->stash_frames)
tdep_stash_frame (c, rs); tdep_stash_frame (c, rs);
return 0; return ret;
} }
/* Find the saved locations. */ /* Find the saved locations. */
@ -943,7 +947,7 @@ dwarf_step (struct dwarf_cursor *c)
return ret; return ret;
c->ret_addr_column = sr.rs_current.ret_addr_column; c->ret_addr_column = sr.rs_current.ret_addr_column;
return 1; return ret;
} }
HIDDEN int HIDDEN int

View file

@ -84,8 +84,7 @@ unw_step (unw_cursor_t *cursor)
{ {
/* x86_64 ABI specifies that end of call-chain is marked with a /* x86_64 ABI specifies that end of call-chain is marked with a
NULL RBP or undefined return address */ NULL RBP or undefined return address */
if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]) if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]))
|| DWARF_IS_NULL_LOC(c->dwarf.loc[c->dwarf.ret_addr_column]))
{ {
c->dwarf.ip = 0; c->dwarf.ip = 0;
ret = 0; ret = 0;