forked from OSchip/llvm-project
Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto the stack and "ret" will pop it automatically. The FDE of the caller contains the amount of stack space used for arguments (and possibly extra padding), so unwinding has to compensate for this when "returning" from a function. This is exactly the case when step() is done. The existing handling in unw_set_reg no longer makes sense. llvm-svn: 204290
This commit is contained in:
parent
fcd974a1ed
commit
1ed1a3d994
|
@ -1041,6 +1041,8 @@ int UnwindCursor<A, R>::step() {
|
|||
this->setInfoBasedOnIPRegister(true);
|
||||
if (_unwindInfoMissing)
|
||||
return UNW_STEP_END;
|
||||
if (_info.gp)
|
||||
setReg(UNW_REG_SP, getReg(UNW_REG_SP) + _info.gp);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -174,9 +174,6 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
|
|||
pint_t orgArgSize = (pint_t)info.gp;
|
||||
uint64_t orgFuncStart = info.start_ip;
|
||||
co->setInfoBasedOnIPRegister(false);
|
||||
// and adjust REG_SP if there was a DW_CFA_GNU_args_size
|
||||
if ((orgFuncStart == info.start_ip) && (orgArgSize != 0))
|
||||
co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + orgArgSize);
|
||||
}
|
||||
return UNW_ESUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue