diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2020-05-29 00:05:08 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2020-06-04 23:14:52 +0200 |
| commit | cb2d7f800a9fc276b96fd0927fa6d8ec9f5a31c8 (patch) | |
| tree | 3fcd11e34885c4dddc459c875c94e3b958d7750a /libpcsxcore/psxinterpreter.c | |
| parent | 850010a96b6cbc3eae03edd891e50325e017b678 (diff) | |
| download | pcsxr-cb2d7f800a9fc276b96fd0927fa6d8ec9f5a31c8.tar.gz | |
Implemented port-specific wrappers and logic for gdb stub
Diffstat (limited to 'libpcsxcore/psxinterpreter.c')
| -rw-r--r-- | libpcsxcore/psxinterpreter.c | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index a2bc0e1d..941fda4b 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -1198,6 +1198,68 @@ static void intClear(u32 Addr, u32 Size) { static void intShutdown() { } +static void process_gdb(void) { + static int shutdown; + static u32 tgt_addr; + static int step, must_continue; + struct msg msg; + + if (shutdown) + return; + + if (step || (must_continue && tgt_addr && tgt_addr == psxRegs.pc)) { + msg.type = MSG_TYPE_HIT; +#if DEBUG == 1 + printf("hit address 0x%08X\n", psxRegs.pc); +#endif + gdbstub_sys_send(&msg); + must_continue = 0; + step = 0; + } + + if (!must_continue) { + gdbstub_sys_recv(&msg); + + switch (msg.type) { + case MSG_TYPE_CONTINUE: + must_continue = 1; + break; + + case MSG_TYPE_STEP: + step = 1; + break; + + case MSG_TYPE_REMOVE_BREAKPOINT: { + struct msg out; + + tgt_addr = 0; + out.type = MSG_TYPE_ACK; + + gdbstub_sys_send(&out); + } + break; + + case MSG_TYPE_BREAKPOINT: { + struct msg out; + + tgt_addr = msg.data.breakpoint.addr; + out.type = MSG_TYPE_ACK; + + gdbstub_sys_send(&out); + } + break; + + case MSG_TYPE_SHUTDOWN: + shutdown = 1; + break; + + default: + fprintf(stderr, "unknown msg.type %d\n", msg.type); + break; + } + } +} + // interpreter execution static inline void execI() { u32 *code = Read_ICache(psxRegs.pc, FALSE); @@ -1205,7 +1267,7 @@ static inline void execI() { debugI(); - if (Config.GdbServer) dbg_sys_process(); + if (Config.GdbServer) process_gdb(); else if (Config.Debug) ProcessDebug(); psxRegs.pc += 4; |
