I have been trying to get breakpoints working and implemented most of the code here already. This StackOverflow post explains data breakpoints in a nutshell which seems to match with my research for the most part.
The idea is to use the hardware debug registers DABR/IABR:
Consult the OSContext struct definition here or here for more information about its fields. I used IDA Pro by the way to figure out the OSContext offsets as well so they are quite certainly correct.
I tried OSSetExceptionCallback() and __OSSetInterruptHandler() to register the handler but neither of them causes the handler to ever be called even when a breakpoint should be hit. I decided to turn on interrupts/the debugger by calling/patching the respective functions because it seems like debugging is disabled by default. Still, this didn't change anything. Breakpoints are never hit. I only tried the OSSetDABR and OSSetIABR coreinit.rpl functions though.
Do you have an idea of how breakpoints can be realized correctly or maybe I made a mistake somewhere in my approach since I'm pretty sure that I'm close?
Thank you very much
@QuarkTheAwesome
@dimok
@FIX94
@CosmoCortney
@skoolzout1
@NWPlayer123
@wj44
@shinyquagsire23
The idea is to use the hardware debug registers DABR/IABR:
- Via setDABR or setIABR syscalls
- Via the OSSetDABR, OSSetIABR coreinit.rpl functions
- Via the assembly instructions "move to special purpose register" mtspr 0x3F5, r4 and mtspr 0x3F2, r4 where r4 is the value to move to the respective hardware register
Code:#define DATA_ADDRESS_BREAKPOINT_REGISTER 0x3F5 #define INSTRUCTION_ADDRESS_BREAKPOINT_REGISTER 0x3F2
Code:
unsigned char breakPointHandler(void *interruptedContext);
Do you have an idea of how breakpoints can be realized correctly or maybe I made a mistake somewhere in my approach since I'm pretty sure that I'm close?
Thank you very much
@QuarkTheAwesome
@dimok
@FIX94
@CosmoCortney
@skoolzout1
@NWPlayer123
@wj44
@shinyquagsire23
Last edited by BullyWiiPlaza,