[Bug 51673] New: AArch64 debug problems on Windows

Bug ID 51673
Summary AArch64 debug problems on Windows
Product lldb
Version 10.0
Hardware Other
OS Windows NT
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter eric@andante.org
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

I was using lldb on Windows (Raspberry Pi 4 - ARM Cortex-A72 processor), and
there were a couple of x86-isms that persist that make it impossible to set and
use breakpoints.

Platform::GetSoftwareBreakpointTrapOpcode()
NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode()
Uses "0xd4 0x20 0x00 0x00" for breakpoint on aarch64, but this does not work on
Windows as it fails with a STATUS_ILLEGAL_INSTRUCTION exception being thrown.

  case llvm::Triple::aarch64: {
    static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};

The compiler intrinsic __debug_break() generates "{0x00, 0x00, 0x3e, 0xd4}". 
If I instead use this, then the program stops at the requested breakpoint, as
expected.

Martin Storsjö changed bug 51673

What Removed Added
Resolution FIXED
Fixed By Commit(s) 9f34f75ff8f49b0efca6e20d916527a2c432d8b4
Status NEW RESOLVED

Comment # 17 on bug 51673 from Martin Storsjö

I pushed a fix incorporating these changes now in
[https://github.com/llvm/llvm-project/commit/9f34f75ff8f49b0efca6e20d916527a2c432d8b4](https://github.com/llvm/llvm-project/commit/9f34f75ff8f49b0efca6e20d916527a2c432d8b4).