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: Dynarmic only supports ARM breakpoints, not Thumb #3

Open
DimitriPilot3 opened this issue Jan 31, 2019 · 0 comments
Open

gdbstub: Dynarmic only supports ARM breakpoints, not Thumb #3

DimitriPilot3 opened this issue Jan 31, 2019 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@DimitriPilot3
Copy link
Owner

DimitriPilot3 commented Jan 31, 2019

Opcode for a bkpt 0 ARM instruction: 0xE1200070 (little endian bytes: 70 00 20 E1)
Opcode for a bkpt 0 Thumb instruction: 0xBE00 (little endian bytes: 00 BE)

Currently, GDBStub::CommitBreakpoint hardcodes the ARM opcode in so that the JIT/Dynarmic gets simple breakpoint support through the CPU exception handler. However, one can't expect GDBStub to guess if the target code is in ARM-mode or Thumb-mode: if guessed wrong, then it'll corrupt the code and cause unexpected behaviour. (We could look for odd addresses ending in 2, 6, A, or E, but this would merely be a hack / an edge case.)

Fortunately, as long as not more than 1 instruction is corrupted, DynCom / interpreter wouldn't care anyway, as it uses GDBStub::GetNextBreakpointFromAddress after each dispatch to predict when it's about to hit a breakpoint.

Idea: move the logic of installing a bkpt 0 opcode out of CommitBreakpoint and RemoveBreakpoint, and into the JIT somehow.

@DimitriPilot3 DimitriPilot3 changed the title gdbstub: Only ARM breakpoints are supported, not Thumb gdbstub: Dynarmic only supports ARM breakpoints, not Thumb Jan 31, 2019
@DimitriPilot3 DimitriPilot3 added bug Something isn't working enhancement New feature or request labels Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant