<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80665>80665</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Hardware break and watchpoints are not supported on Windows on Arm (arm64)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
lldb,
platform:windows
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
DavidSpickett
</td>
</tr>
</table>
<pre>
Using an example like:
```
int main() {
char ar[4] = {0,0,0,0};
ar[0] = 1;
ar[1] = 2;
ar[2] = 3;
ar[3] = 4;
return 0;
}
```
On Windows on Arm, if you try to break `main` with a hardware break you get:
```
(lldb) breakpoint set -H -n main
warning: failed to set breakpoint site at 0x7ff6a97ee98c for breakpoint 2.1: Hardware breakpoints are not supported.
Breakpoint 2: where = a.exe`main at main.c:1, address = 0x00007ff6a97ee98c
```
If you try to watch `ar` you get:
```
(lldb) watchpoint set variable ar
error: Watchpoint creation failed (addr=0x46286ffde8, size=4, variable expression='ar').
error: Can't enable watchpoint 1 on thread 0x844
```
For some reason, lldb is able to detect a number of watchpoints:
```
(lldb) watchpoint list
Number of supported hardware watchpoints: 4
No watchpoints currently set.
```
But I can't confirm if we should expect 4 on this Surface Pro X machine, could just be reading garbage data.
The cause of this is that `NativeRegisterContextWindows_WoW64::SetHardwareWatchpoint` and associated code only has the Intel debug register names in it. For example `ApplyHardwareBreakpoint` writes to `lldb_dr7_i386` which I assume is being rejected by the kernel.
The type being used is https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-wow64_context, there is an arm64 equivalent I expect but couldn't find it myself.
This is also the reason that the watchpoint test category is disabled on the Windows On Arm lldb bot - https://github.com/llvm/llvm-zorg/blob/590f0a62919ad313758362d18a31e7d40255e6e6/buildbot/osuosl/master/config/builders.py#L1353.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVtFu47gO_RrlhWggy46TPOQhbRBMgY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