[Lldb-commits] [PATCH] D67911: [LLDB] [Windows] Add missing ifdefs to fix building for non-x86 architectures

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 23 13:49:44 PDT 2019


mstorsjo updated this revision to Diff 221406.
mstorsjo added a comment.

Added a log message, changed an `x86_64` ifdef into `_WIN64`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67911/new/

https://reviews.llvm.org/D67911

Files:
  lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp


Index: lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
+++ lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp
@@ -84,7 +84,7 @@
   case 1:
   case 2:
   case 4:
-#if defined(__x86_64__) || defined(_M_AMD64)
+#if defined(_WIN64)
   case 8:
 #endif
     break;
@@ -95,6 +95,7 @@
   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,11 @@
   m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
 
   return ApplyAllRegisterValues();
+
+#else
+  LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
+  return false;
+#endif
 }
 
 bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +124,25 @@
   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;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67911.221406.patch
Type: text/x-patch
Size: 1688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190923/037ccc53/attachment.bin>


More information about the lldb-commits mailing list