Skip to content

Commit d0166a0

Browse files
committedJul 17, 2018
The semantics of DW_CFA_GNU_args_size have changed subtile over the
years. Adopt the new convention that it is call-site specific and that it should be applied before moving the IP by personality routines, but not during normal unwinding. Differential Revision: https://reviews.llvm.org/D38680 llvm-svn: 337312
1 parent 97ba3b6 commit d0166a0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎libunwind/src/UnwindCursor.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,8 +1411,6 @@ int UnwindCursor<A, R>::step() {
14111411
this->setInfoBasedOnIPRegister(true);
14121412
if (_unwindInfoMissing)
14131413
return UNW_STEP_END;
1414-
if (_info.gp)
1415-
setReg(UNW_REG_SP, getReg(UNW_REG_SP) + _info.gp);
14161414
}
14171415

14181416
return result;

‎libunwind/src/libunwind.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,20 @@ _LIBUNWIND_EXPORT int unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
188188
co->setReg(regNum, (pint_t)value);
189189
// specical case altering IP to re-find info (being called by personality
190190
// function)
191-
if (regNum == UNW_REG_IP)
191+
if (regNum == UNW_REG_IP) {
192+
unw_proc_info_t info;
193+
// First, get the FDE for the old location and then update it.
194+
co->getInfo(&info);
192195
co->setInfoBasedOnIPRegister(false);
196+
// If the original call expects stack adjustment, perform this now.
197+
// Normal frame unwinding would have included the offset already in the
198+
// CFA computation.
199+
// Note: for PA-RISC and other platforms where the stack grows up,
200+
// this should actually be - info.gp. LLVM doesn't currently support
201+
// any such platforms and Clang doesn't export a macro for them.
202+
if (info.gp)
203+
co->setReg(UNW_REG_SP, co->getReg(UNW_REG_SP) + info.gp);
204+
}
193205
return UNW_ESUCCESS;
194206
}
195207
return UNW_EBADREG;

0 commit comments

Comments
 (0)
Please sign in to comment.