[Lldb-commits] [lldb] r372699 - [LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

Martin Storsjo via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 24 01:39:06 PDT 2019


Author: mstorsjo
Date: Tue Sep 24 01:39:06 2019
New Revision: 372699

URL: http://llvm.org/viewvc/llvm-project?rev=372699&view=rev
Log:
[LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

While debugging on those architectures might not be supported yet,
the generic code should still be buildable. This file accesses x86
specific fields in the CONTEXT struct.

Differential Revision: https://reviews.llvm.org/D67911

Modified:
    lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp?rev=372699&r1=372698&r2=372699&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp Tue Sep 24 01:39:06 2019
@@ -84,7 +84,7 @@ bool RegisterContextWindows::AddHardware
   case 1:
   case 2:
   case 4:
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(_WIN64)
   case 8:
 #endif
     break;
@@ -95,6 +95,7 @@ bool RegisterContextWindows::AddHardware
   if (!CacheAllRegisterValues())
     return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 |= 1ULL << shift;
 
@@ -109,6 +110,12 @@ bool RegisterContextWindows::AddHardware
   m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
 
   return ApplyAllRegisterValues();
+
+#else
+  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_REGISTERS);
+  LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
+  return false;
+#endif
 }
 
 bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +125,25 @@ bool RegisterContextWindows::RemoveHardw
   if (!CacheAllRegisterValues())
     return false;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   unsigned shift = 2 * slot;
   m_context.Dr7 &= ~(1ULL << shift);
 
   return ApplyAllRegisterValues();
+#else
+  return false;
+#endif
 }
 
 uint32_t RegisterContextWindows::GetTriggeredHardwareBreakpointSlotId() {
   if (!CacheAllRegisterValues())
     return LLDB_INVALID_INDEX32;
 
+#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
   for (unsigned i = 0UL; i < NUM_HARDWARE_BREAKPOINT_SLOTS; i++)
     if (m_context.Dr6 & (1ULL << i))
       return i;
+#endif
 
   return LLDB_INVALID_INDEX32;
 }




More information about the lldb-commits mailing list