Skip to content

Commit cc8bd6e

Browse files
mstorsjocompnerd
authored andcommitted
[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 llvm-svn: 372699 (cherry picked from commit 02dddfd)
1 parent a223244 commit cc8bd6e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ bool RegisterContextWindows::AddHardwareBreakpoint(uint32_t slot,
8484
case 1:
8585
case 2:
8686
case 4:
87-
#if defined(_M_AMD64)
87+
#if defined(_WIN64)
8888
case 8:
8989
#endif
9090
break;
@@ -95,6 +95,7 @@ bool RegisterContextWindows::AddHardwareBreakpoint(uint32_t slot,
9595
if (!CacheAllRegisterValues())
9696
return false;
9797

98+
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
9899
unsigned shift = 2 * slot;
99100
m_context.Dr7 |= 1ULL << shift;
100101

@@ -109,6 +110,12 @@ bool RegisterContextWindows::AddHardwareBreakpoint(uint32_t slot,
109110
m_context.Dr7 |= (read ? 3ULL : (write ? 1ULL : 0)) << shift;
110111

111112
return ApplyAllRegisterValues();
113+
114+
#else
115+
Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_REGISTERS);
116+
LLDB_LOG(log, "hardware breakpoints not currently supported on this arch");
117+
return false;
118+
#endif
112119
}
113120

114121
bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
@@ -118,19 +125,25 @@ bool RegisterContextWindows::RemoveHardwareBreakpoint(uint32_t slot) {
118125
if (!CacheAllRegisterValues())
119126
return false;
120127

128+
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
121129
unsigned shift = 2 * slot;
122130
m_context.Dr7 &= ~(1ULL << shift);
123131

124132
return ApplyAllRegisterValues();
133+
#else
134+
return false;
135+
#endif
125136
}
126137

127138
uint32_t RegisterContextWindows::GetTriggeredHardwareBreakpointSlotId() {
128139
if (!CacheAllRegisterValues())
129140
return LLDB_INVALID_INDEX32;
130141

142+
#if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_AMD64)
131143
for (unsigned i = 0UL; i < NUM_HARDWARE_BREAKPOINT_SLOTS; i++)
132144
if (m_context.Dr6 & (1ULL << i))
133145
return i;
146+
#endif
134147

135148
return LLDB_INVALID_INDEX32;
136149
}

0 commit comments

Comments
 (0)