rizin/librz/debug/p/native/reg.c
GustavoLCR 53a7694631
Add support for Windows on ARM (#1502)
* Support building for Windows on ARM

* Fix usage of reserved function name on ARM
* Fix architecture dependent `CONTEXT` fields access

* Fixes for debugging on Windows on ARM

* Fix breakpoint behavior on windows on ARM
* Fix register profile when debugging
* Remove `drx` error message if not supported
* Add support for hardware breakpoints
* Disable support for hardware single-stepping

* Fix Windows Message breakpoints on ARM

* Fix software single-stepping on return instruction on ARM

* Consider link register as destination for return instructions

* Fix setting debug bits to 16

* Rename `r12` to `ip` for windows arm register profile

* Remove debug bits hardcoding on windows

* Add 32bit registers to Windows ARM64 register profile

* Fix software step breakpoint alignment when entering thumb mode

* Define `RZ_TEST_ARCH` for `arm` and `arm64`

* Use `StackWalk64` API for backtracing on Windows

* Fix software single-stepping ARM in thumb mode

* Sync `asm.bits` with debugger

* Cleanup windows_debug.c

* Add SPDX for cross-arm64-windows.txt

* Add floating point control register flags

* Fix Windows Arm register profile alignment

* Keep `drx` warning
2021-11-24 20:13:42 +08:00

67 lines
1.3 KiB
C

// SPDX-FileCopyrightText: 2014 pancake <pancake@nopcode.org>
// SPDX-License-Identifier: LGPL-3.0-only
// included from p/debug_native.c
// split for better reading/cleaning up
static char *rz_debug_native_reg_profile(RzDebug *dbg) {
#if __WINDOWS__
/*_______
| | |
|___|___|
| | |
|___|___|
*/
#if defined(__arm64__)
#include "reg/windows-arm64.h"
#elif defined(__arm__)
#include "reg/windows-arm.h"
#elif defined(__x86_64__)
#include "reg/windows-x64.h"
#elif defined(__i386__)
#include "reg/windows-x86.h"
#endif
#elif (__OpenBSD__ || __NetBSD__)
/* __.--..__
\-/-/-/ _ __ _.--' _.--'
_ \' \ \\ '' `------.__
\\/ __)_) \\ ____..---'
//\ o o \\----'
/ <_/ 3 \\
\_,_,__,_/ \\
*/
#if __i386__
#include "reg/netbsd-x86.h"
#elif __x86_64__
#include "reg/netbsd-x64.h"
#else
#error "Unsupported BSD architecture"
#endif
#elif __KFBSD__ || __FreeBSD__
/*
/( ).
\ \__ /|
/ _ '-/ |
(/\/ | \
/ / | \ )
O O _/ |
(__) __ /
\___/ /
`----'
*/
#if __i386__ || __i386
#include "reg/kfbsd-x86.h"
#elif __x86_64__ || __amd64__
#include "reg/kfbsd-x64.h"
#elif __aarch64__
#include "reg/kfbsd-arm64.h"
#else
#error "Unsupported BSD architecture"
#endif
#else
#warning Unsupported Kernel
return NULL;
#endif
}