Martin 656cdd948e [dynarmic] Fix guest debugging with gdb-stub (#4620)
I wanted to debug an ARM32 guest application using gdb-stub, which did not work: After using watchpoints, or software breakpoints the program cannot be resumed.

The following PR fixes those issues seen so I can properly use gdb. I used two separate commits, but can squash them if you like.

**Elision of in-block register saving**
Contrary to [the A64 path](https://git.eden-emu.dev/eden-emu/eden/src/commit/7a6d055094846b7787f9b8c0f238c0c68709f632/src/dynarmic/src/dynarmic/ir/opt_passes.cpp#L1468), for A32 guests, `conf.check_halt_on_memory_access` is not considered when deciding to use `GetSetElimination`. This destroys the register state when using watchpoints (which utilizes dynarmics `MemoryAbort`).
A test is added to verify correct behavior.

**Improper invalidation of Eden's internal caching**
Eden's internal caching of single guest code pages does not properly invalidate the CodePage when `InvalidateCacheRange` is called. This issue is present in both, A32 and A64 variants. Thus, when gdb modifies the guest code back to contain the original instruction after hitting a breakpoint this code is not retranslated and we can not continue from the breakpoint.

Unfortunately adding a test for this is harder as it depends on the interaction: write memory -> `InvalidateCacheRange` -> assert next `MemoryReadCode` returns new bytes. Which I think can't be constructed without a real process + memory subsystem.
The two changes for this issue are quite minimal, that is why I hope to get by without a test. I added an equivalent A32/test_invalidation.cpp, which did not exist compared to A64, but this does not cover Edens caching mechanic.

Assisted-by: kiro-cli (no specific model/auto mode used) (issue analysis, writing the tests)

- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
- [x] I have read and followed the [website policy](https://git.eden-emu.dev/eden-emu/site-policy).
- [x] I affirm that the content of this pull request body was written and submitted entirely by me, in my own words, and not by an AI agent or LLM.
- [ ] I affirm that I did not read any of this, and understand that my pull request will be closed if I check this box.
- [x] I affirm that, by submitting this pull request, I am responsible for all of the changes contained within these commits.

-------------------

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4620
Reviewed-by: crueter <crueter@eden-emu.dev>
2026-11-08 03:30:28 +01:00
…
2026-11-01 05:16:02 +01:00
…
…
…


Eden
Eden

Eden is a free and open-source (FOSS) Switch 1 emulator started by developer Camille LaVey.
Written in C++, with builds for Windows, Linux, macOS, Android, FreeBSD and more.

Discord Stoat

Compatibility | Contribute | Building | Download | License

Compatibility

The emulator is capable of running most commercial games at full speed, provided you meet the necessary hardware requirements.

A list of supported games will be available in future. Please be patient.

Check out our website for the latest news on exciting features, monthly progress reports, and more!

Packaging status

Contribute

To contribute to Eden; be it financially, code, bug reports, or otherwise, see our Contributing guidelines.

Documentation

We have a user manual! See our User Handbook.

Building

See the General Build Guide

For information on provided development tooling, see the Tools directory

Download

You can download the latest releases from our release page.

Save us some bandwidth! We have mirrors available as well.

License

Eden is licensed under the GPLv3 (or any later version). Refer to the LICENSE.txt file.

Special thanks

Super special thanks to Cloudflare for preventing the git server from blowing up.

  • Yuzu
  • Ryujinx
  • Sudachi
  • Citron
  • Torzu
  • Suyu
  • Ryubing

And everyone who continues or had contributed to the project! <3

Languages
C++ 89.5%
POV-Ray SDL 4.3%
Kotlin 4%
CMake 0.8%
SourcePawn 0.5%
Other 0.8%