-
-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Windows on ARM #1502
Conversation
4e0297e
to
48407c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a new file sys/cross-arm64-windows.txt
. I wonder if it make sense to document how to use it/build for the Windows ARM64 in BUILDING.md
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I can take a bit of time for manual testing as well on my systems :)
48407c8
to
6807150
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"cl" "-Ilibrz/debug\rz_debug.dll.p" "-I." "-I.." "-I..\librz\include" "-I..\librz\bin\format\elf" "-I..\shlr\qnx\include" "-I..\shlr\gdb\include" "-I..\shlr\gdb\include\gdbclient" "-I..\shlr\gdb\include\gdbserver" "-I..\shlr\bochs\include" "-I..\shlr\winkd" "-Isubprojects\sdb" "-I..\subprojects\sdb" "-Isubprojects\sdb\src" "-I..\subprojects\sdb\src" "-I..\librz\analysis\arch\gb" "-I..\librz\analysis\arch\hexagon" "-I..\shlr\w32dbg_wrap\include" "/MD" "/nologo" "/showIncludes" "/W2" "/O2" "/Gw" "-DRZ_PLUGIN_INCORE=1" "/Fdlibrz/debug\rz_debug.dll.p\p_debug_gdb.c.pdb" /Folibrz/debug/rz_debug.dll.p/p_debug_gdb.c.obj "/c" ../librz/debug/p/debug_gdb.c
D:\a\rizin\rizin\librz\debug\p\native\bt/windows-all.c(82): error C2065: 'IMAGE_FILE_MACHINE_i386': undeclared identifier
One more thing. This pull request combines both fixes for analysis (and PE binary parsing) and debugger. I suggest to extract the analysis fix to the separate PR and add a new test for it. Then we can include this analysis fix into 0.3.0, while ARM debugger has to wait for 0.4.0, ok? cc @ret2libc
6807150
to
3ec5678
Compare
In theory it shouldn't be affected by your code, but it only happens in your branch only (I saw it even before the PR, it appears quite consistently), see:
I guess it's either timezone problem or something unitialized. Might be related to #982 (comment) |
3ec5678
to
98e007a
Compare
* Fix usage of reserved function name on ARM * Fix architecture dependent `CONTEXT` fields access
* 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
* Consider link register as destination for return instructions
eea1ad2
to
472d9b8
Compare
@@ -497,16 +497,26 @@ static inline void *rz_new_copy(int size, void *data) { | |||
#endif | |||
#else | |||
#ifdef _MSC_VER | |||
#ifdef _WIN64 | |||
#if defined(_M_X64) || defined(_M_AMD64) | |||
#define RZ_SYS_ARCH "x86" | |||
#define RZ_SYS_BITS (RZ_SYS_BITS_32 | RZ_SYS_BITS_64) | |||
#define RZ_SYS_ENDIAN 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Meson could get endian value from .endian()
function, see:
- https://mesonbuild.com/Reference-tables.html#cpu-families
cc @ret2libc
Maybe we should drop those and use it instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be done in a separate PR though, obviously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Code looks OK.
- Tested on Windows 10 x86_64 - debugging and heap parsing works fine.
@yossizap could you please confirm if these changes are fine?
* 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
Your checklist for this pull request
Detailed description
Test plan
Manually tested
Closing issues
None