Simplify conditionals in DNBArchMachARM64::EnableHardwareSingleStep
authorJason Molenda <jason@molenda.com>
Mon, 29 Jun 2020 21:04:44 +0000 (14:04 -0700)
committerJason Molenda <jason@molenda.com>
Mon, 29 Jun 2020 21:04:44 +0000 (14:04 -0700)
lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp

index 3e7bda8..7e1af7a 100644 (file)
@@ -590,23 +590,21 @@ kern_return_t DNBArchMachARM64::EnableHardwareSingleStep(bool enable) {
     return err.Status();
   }
 
-  if (enable) {
-    DNBLogThreadedIf(LOG_STEP,
-                     "%s: Setting MDSCR_EL1 Single Step bit at pc 0x%llx",
 #if defined(__LP64__)
-                     __FUNCTION__, (uint64_t)arm_thread_state64_get_pc (m_state.context.gpr));
+  uint64_t pc = arm_thread_state64_get_pc (m_state.context.gpr);
 #else
-                     __FUNCTION__, (uint64_t)m_state.context.gpr.__pc);
+  uint64_t pc = m_state.context.gpr.__pc;
 #endif
+
+  if (enable) {
+    DNBLogThreadedIf(LOG_STEP,
+                     "%s: Setting MDSCR_EL1 Single Step bit at pc 0x%llx",
+                     __FUNCTION__, pc);
     m_state.dbg.__mdscr_el1 |= SS_ENABLE;
   } else {
     DNBLogThreadedIf(LOG_STEP,
                      "%s: Clearing MDSCR_EL1 Single Step bit at pc 0x%llx",
-#if defined(__LP64__)
-                     __FUNCTION__, (uint64_t)arm_thread_state64_get_pc (m_state.context.gpr));
-#else
-                     __FUNCTION__, (uint64_t)m_state.context.gpr.__pc);
-#endif
+                     __FUNCTION__, pc);
     m_state.dbg.__mdscr_el1 &= ~(SS_ENABLE);
   }