diff --git a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp --- a/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp +++ b/lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp @@ -2022,10 +2022,41 @@ switch (set) { case e_regSetGPR: if (reg <= gpr_pc) { - if (reg == gpr_pc || reg == gpr_lr || reg == gpr_sp || reg == gpr_fp) - value->value.uint64 = clear_pac_bits(m_state.context.gpr.__x[reg]); - else + switch (reg) { +#if __has_feature(ptrauth_calls) && defined(__LP64__) + case gpr_pc: + value->value.uint64 = clear_pac_bits( + reinterpret_cast(m_state.context.gpr.__opaque_pc)); + break; + case gpr_lr: + value->value.uint64 = clear_pac_bits( + reinterpret_cast(m_state.context.gpr.__opaque_lr)); + break; + case gpr_sp: + value->value.uint64 = clear_pac_bits( + reinterpret_cast(m_state.context.gpr.__opaque_sp)); + break; + case gpr_fp: + value->value.uint64 = clear_pac_bits( + reinterpret_cast(m_state.context.gpr.__opaque_fp)); + break; +#else + case gpr_pc: + value->value.uint64 = clear_pac_bits(m_state.context.gpr.__pc); + break; + case gpr_lr: + value->value.uint64 = clear_pac_bits(m_state.context.gpr.__lr); + break; + case gpr_sp: + value->value.uint64 = clear_pac_bits(m_state.context.gpr.__sp); + break; + case gpr_fp: + value->value.uint64 = clear_pac_bits(m_state.context.gpr.__fp); + break; +#endif + default: value->value.uint64 = m_state.context.gpr.__x[reg]; + } return true; } else if (reg == gpr_cpsr) { value->value.uint32 = m_state.context.gpr.__cpsr;