diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-01-08 15:31:41 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-01-08 15:31:41 +0000 |
| commit | 13bc98faa81df781bd227d91ef52edeb8ea8b0ea (patch) | |
| tree | 8a4a1e0710e502502256ce43b7b9ab04bfd7216d /libpcsxcore/debug.c | |
| parent | a822176df79d4922cfbf2430934efbda27027c85 (diff) | |
debug.c;
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82109 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore/debug.c')
| -rwxr-xr-x | libpcsxcore/debug.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/libpcsxcore/debug.c b/libpcsxcore/debug.c index fc717da6..99d2a53a 100755 --- a/libpcsxcore/debug.c +++ b/libpcsxcore/debug.c @@ -127,7 +127,9 @@ Execution flow control commands (3xx): 391 Restarts execution. 395 [number] - Traces execution, 1 instruction by default. Formatted using %i + Traces execution, 1 instruction by default. Formatted using %i. +396 [number] + Disassemble and print current PC in trace mode. 398 Soft (quick) resets. 399 @@ -204,6 +206,8 @@ Execution flow control commands acknowledge (4xx): Resuming. 495 <message> Tracing. +496 <message> + Printing. 498 <message> Soft resetting. 499 <message> @@ -225,7 +229,7 @@ Error messages (5xx): Invalid breakpoint address. */ -static int debugger_active = 0, paused = 0, trace = 0, reset = 0, resetting = 0; +static int debugger_active = 0, paused = 0, trace = 0, printpc = 0, reset = 0, resetting = 0; static int mapping_e = 0, mapping_r8 = 0, mapping_r16 = 0, mapping_r32 = 0, mapping_w8 = 0, mapping_w16 = 0, mapping_w32 = 0; static int breakmp_e = 0, breakmp_r8 = 0, breakmp_r16 = 0, breakmp_r32 = 0, breakmp_w8 = 0, breakmp_w16 = 0, breakmp_w32 = 0; @@ -389,6 +393,13 @@ void ProcessDebug() { } } if (!paused) { + if(trace && printpc) + { + char reply[256]; + sprintf(reply, "219 %s\r\n", disR3000AF(psxMemRead32(psxRegs.pc), psxRegs.pc)); + WriteSocket(reply, strlen(reply)); + } + DebugCheckBP(psxRegs.pc, BE); } if (mapping_e) { @@ -466,11 +477,11 @@ static void ProcessCommands() { if (!arguments) { reply[0] = 0; for (i = 0; i < 32; i++) { - sprintf(reply, "%s211 %02X=%08X\r\n", reply, i, psxRegs.GPR.r[i]); + sprintf(reply, "%s211 %02X(%2.2s)=%08X\r\n", reply, i, disRNameGPR[i], psxRegs.GPR.r[i]); } } else { if ((code >= 0) && (code < 32)) { - sprintf(reply, "211 %02X=%08X\r\n", code, psxRegs.GPR.r[code]); + sprintf(reply, "211 %02X(%2.2s)=%08X\r\n", code, disRNameGPR[code], psxRegs.GPR.r[code]); } else { sprintf(reply, "511 Invalid GPR register: %X\r\n", code); } @@ -489,11 +500,11 @@ static void ProcessCommands() { if (!arguments) { reply[0] = 0; for (i = 0; i < 32; i++) { - sprintf(reply, "%s213 %02X=%08X\r\n", reply, i, psxRegs.CP0.r[i]); + sprintf(reply, "%s213 %02X(%8.8s)=%08X\r\n", reply, i, disRNameCP0[i], psxRegs.CP0.r[i]); } } else { if ((code >= 0) && (code < 32)) { - sprintf(reply, "213 %02X=%08X\r\n", code, psxRegs.CP0.r[code]); + sprintf(reply, "213 %02X(%8.8s)=%08X\r\n", code, disRNameCP0[code], psxRegs.CP0.r[code]); } else { sprintf(reply, "511 Invalid COP0 register: %X\r\n", code); } @@ -509,11 +520,11 @@ static void ProcessCommands() { if (!arguments) { reply[0] = 0; for (i = 0; i < 32; i++) { - sprintf(reply, "%s214 %02X=%08X\r\n", reply, i, psxRegs.CP2C.r[i]); + sprintf(reply, "%s214 %02X(%6.6s)=%08X\r\n", reply, i, disRNameCP2C[i], psxRegs.CP2C.r[i]); } } else { if ((code >= 0) && (code < 32)) { - sprintf(reply, "214 %02X=%08X\r\n", code, psxRegs.CP2C.r[code]); + sprintf(reply, "214 %02X(%6.6s)=%08X\r\n", code, disRNameCP2C[code], psxRegs.CP2C.r[code]); } else { sprintf(reply, "511 Invalid COP2C register: %X\r\n", code); } @@ -529,11 +540,11 @@ static void ProcessCommands() { if (!arguments) { reply[0] = 0; for (i = 0; i < 32; i++) { - sprintf(reply, "%s215 %02X=%08X\r\n", reply, i, psxRegs.CP2D.r[i]); + sprintf(reply, "%s215 %02X(%4.4s)=%08X\r\n", reply, i, disRNameCP2D[i], psxRegs.CP2D.r[i]); } } else { if ((code >= 0) && (code < 32)) { - sprintf(reply, "215 %02X=%08X\r\n", code, psxRegs.CP2D.r[code]); + sprintf(reply, "215 %02X(%4.4s)=%08X\r\n", code, disRNameCP2D[code], psxRegs.CP2D.r[code]); } else { sprintf(reply, "511 Invalid COP2D register: %X\r\n", code); } @@ -1045,6 +1056,16 @@ static void ProcessCommands() { paused = 0; sprintf(reply, "495 Tracing\r\n"); break; + case 0x396: + p = arguments; + if (arguments) { + printpc = strtol(arguments, &p, 10); + } + if (p == arguments) { + printpc = !printpc; + } + sprintf(reply, "496 Printing %s\r\n", printpc ? "enabled" : "disabled"); + break; case 0x398: paused = 0; trace = 0; |
