Skip to content
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

gdbstub: only let Execute breakpoints write/restore BKPT opcodes into memory #4603

merged 1 commit into from Feb 1, 2019


Copy link

@DimitriPilot3 DimitriPilot3 commented Jan 26, 2019

Back in August last year, commit bd658a8 implemented logic for code breakpoints to be hit via a bkpt 0 opcode that temporarily overwrites the targeted instruction (by the CommitBreakpoint / RemoveBreakpoint functions). However, this is also done inadvertently for watchpoints (Read-, Write-, or Access-type breakpoint types), which can corrupt data used by the software (#4502). This PR adds a simple check to both functions.

Note to users/testers: Currently, CPU JIT isn't designed around memory watchpoints, so make sure it's off.
Speaking of which, although my MS2017 debugger reveals that watchpoints are being hit internally (i.e. calls CheckMemoryBreakpoint(VAddr, type) -> GDBStub::Break(true)), the deferred logic I'm seeing (in the interpreter loop?) seems to do nothing: no signal is sent to the GDB client. and the game keeps running.

This other issue is separate from the issue this PR fixes (#4502, even though the OP and I have also mentioned it there) and exists on latest master on my Windows release build. I use the arm-none-eabi-gdb client, and recall getting watchpoints to fire on Luma3ds (real 3DS).

This change is Reviewable

Copy link

@wwylele wwylele left a comment

Code LGTM. I am not very familiar with gdbstub. Anyone else with more experience can give a review?

Copy link

@zhaowenlan1779 zhaowenlan1779 left a comment

The code looks good, but I don't have much experience with gdbstub either :p

@wwylele wwylele merged commit ae57d72 into citra-emu:master Feb 1, 2019
3 checks passed
bunnei added a commit to yuzu-emu/yuzu that referenced this issue Feb 7, 2019
Port citra-emu/citra#4603: "gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memory"
@DimitriPilot3 DimitriPilot3 deleted the gdbstub-watchpoint-fix1 branch Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants