@@ -129,6 +129,8 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
129
129
// First, get the FDE for the old location and then update it.
130
130
co->getInfo (&info);
131
131
132
+ pint_t sp = (pint_t )co->getReg (UNW_REG_SP);
133
+
132
134
#if __has_feature(ptrauth_calls)
133
135
// It is only valid to set the IP within the current function.
134
136
// This is important for ptrauth, otherwise the IP cannot be correctly
@@ -137,8 +139,6 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
137
139
(unw_word_t )ptrauth_strip ((void *)value, ptrauth_key_return_address);
138
140
assert (stripped_value >= info.start_ip && stripped_value <= info.end_ip );
139
141
140
- pint_t sp = (pint_t )co->getReg (UNW_REG_SP);
141
-
142
142
{
143
143
// PC should have been signed with the sp, so we verify that
144
144
// roundtripping does not fail.
@@ -162,7 +162,7 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
162
162
// this should actually be - info.gp. LLVM doesn't currently support
163
163
// any such platforms and Clang doesn't export a macro for them.
164
164
if (info.gp )
165
- co->setReg (UNW_REG_SP, co-> getReg (UNW_REG_SP) + info.gp );
165
+ co->setReg (UNW_REG_SP, sp + info.gp );
166
166
co->setReg (UNW_REG_IP, value);
167
167
co->setInfoBasedOnIPRegister (false );
168
168
} else {
0 commit comments