Debugging on Arm64
This article describes debugging Windows 10 on ARM processors. For general information about Windows 10 on Arm, see Windows 10 desktop on Arm64.
In general, developers debugging user mode apps should use the version of the debugger that matches the architecture of the target app. Use the Arm64 version of WinDbg to debug user mode Arm64 applications and use the Arm version of WinDbg to debug user mode ARM32 applications. Use the x86 version of WinDbg to debug user mode x86 applications running on Arm64 processors.
In rare cases where you need to debug system code – such as WOW64 or CHPE – you can use the Arm64 version of WinDbg. If you're debugging the Arm64 kernel from another machine, use the version of WinDbg that matches the architecture of that other machine.
Getting Arm Debugging Tools for Windows
You can get debugging tools for Arm64 by downloading the Windows SDK (version 10.0.16299 or later). During the installation, select the Debugging Tools for Windows box.
The debugging tools are located in the Debuggers
folder in the kit installation directory. The x86 tools are under Debuggers\x86
, the ARM32 tools are under Debuggers\Arm
, and the Arm64 tools are under Debuggers\Arm64
.
Debugging Arm64 Code
Arm64 WinDbg is required to debug Arm64 code. The debugging experience is similar to debugging x86 applications with x86 WinDbg on x86 Windows, except for the following differences.
- There are 32 general purpose registers - x0 to x28 and fp, lr, sp.
- Program counter register, pc, isn't a general purpose register.
- All general purpose registers and pc register are 64-bit in width.
- At most two active data breakpoints for execution and two active data breakpoints for read/write memory. For more information, see Processor Breakpoints.
Debugging x86 User Mode Code
In the rare cases that you need to use Arm64 WinDbg to debug your x86 user mode code, you can use the following WinDbg commands to switch between contexts:
- .effmach x86: Switch to and see x86 context, simulating the effect of using x86 WinDbg.
- .effmach arm64: Switch to and see Arm64 context
- .effmach chpe: Switch to and see CHPE context.
For more information about the .effmach, see .effmach (Effective Machine).
When debugging x86 apps in user mode, regardless of which WinDbg version you're using, be aware of these considerations.
- If a thread isn't being actively debugged (for example, single-stepped, encountered a breakpoint), not reporting an exception, and not in a system call, the register context may not be up-to-date.
- The emulator internally generates Data misaligned, Illegal instruction, In-page I/O error exceptions and handles the ones it generates. When you're using WinDbg, consider configuring these exceptions as Ignored under the Debug / Event Filters… menu item.
- If using Arm64 WinDbg in user mode, single-stepping across x86 & CHPE function boundaries isn't supported. To work around this, set breakpoints on the target code.
For general information about ARM64 and WOW64, see Running 32-bit Applications in the 64-bit Windows programming guide.
For information on debugging applications running under WOW64, see Debugging WOW64.
Debugging in Visual Studio
For information on debugging Arm in Visual Studio, see Remote Debugging.