Skip to content

Commit 37644e1

Browse files
authored
Merge pull request #7518 from jasonmolenda/cp/dont-strip-auth-bits-from-lr-0725
[lldb] [debugserver] Preserve signing bits on lr in debugserver (llvm#67384)
2 parents 7163857 + fc819cb commit 37644e1

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,23 @@ kern_return_t DNBArchMachARM64::GetGPRState(bool force) {
169169
(thread_state_t)&m_state.context.gpr, &count);
170170
if (DNBLogEnabledForAny(LOG_THREAD)) {
171171
uint64_t *x = &m_state.context.gpr.__x[0];
172+
DNBLogThreaded("thread_get_state signed regs "
173+
"\n fp=%16.16llx"
174+
"\n lr=%16.16llx"
175+
"\n sp=%16.16llx"
176+
"\n pc=%16.16llx",
177+
#if __has_feature(ptrauth_calls) && defined(__LP64__)
178+
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_fp),
179+
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_lr),
180+
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_sp),
181+
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_pc)
182+
#else
183+
m_state.context.gpr.__fp,
184+
m_state.context.gpr.__lr,
185+
m_state.context.gpr.__sp,
186+
m_state.context.gpr.__pc
187+
#endif
188+
);
172189

173190
#if __has_feature(ptrauth_calls) && defined(__LP64__)
174191
uint64_t log_fp = clear_pac_bits(
@@ -2173,8 +2190,7 @@ bool DNBArchMachARM64::GetRegisterValue(uint32_t set, uint32_t reg,
21732190
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_pc));
21742191
break;
21752192
case gpr_lr:
2176-
value->value.uint64 = clear_pac_bits(
2177-
reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_lr));
2193+
value->value.uint64 = arm_thread_state64_get_lr(m_state.context.gpr);
21782194
break;
21792195
case gpr_sp:
21802196
value->value.uint64 = clear_pac_bits(

0 commit comments

Comments
 (0)