all repos — mgba @ ff2a0f8519c89870e681171a1703ab91ade318b8

mGBA Game Boy Advance Emulator

Debugger: Readability improvements (fixes #1238)
Vicki Pfau vi@endrift.com
Wed, 21 Nov 2018 17:21:43 -0500
commit

ff2a0f8519c89870e681171a1703ab91ade318b8

parent

00cbb6156ba020772fb44d6678d3b9142695c854

M CHANGESCHANGES

@@ -152,6 +152,7 @@ - Qt: Detect presence of GL_ARB_framebuffer_object

- Python: Minor API improvements - Qt: Minor memory view tweaks - CMake: Fix libswresample version dependencies (fixes mgba.io/i/1229) + - Debugger: Readability improvements (fixes mgba.io/i/1238) 0.7 beta 1: (2018-09-24) - Initial beta for 0.7
M src/arm/debugger/cli-debugger.csrc/arm/debugger/cli-debugger.c

@@ -125,13 +125,14 @@ static void _printStatus(struct CLIDebuggerSystem* debugger) {

struct CLIDebuggerBackend* be = debugger->p->backend; struct ARMCore* cpu = debugger->p->d.core->cpu; int r; - for (r = 0; r < 4; ++r) { - be->printf(be, "%08X %08X %08X %08X\n", - cpu->gprs[r << 2], - cpu->gprs[(r << 2) + 1], - cpu->gprs[(r << 2) + 2], - cpu->gprs[(r << 2) + 3]); + for (r = 0; r < 16; r += 4) { + be->printf(be, "%sr%i: %08X %sr%i: %08X %sr%i: %08X %sr%i: %08X\n", + r < 10 ? " " : "", r, cpu->gprs[r], + r < 9 ? " " : "", r + 1, cpu->gprs[r + 1], + r < 8 ? " " : "", r + 2, cpu->gprs[r + 2], + r < 7 ? " " : "", r + 3, cpu->gprs[r + 3]); } + be->printf(be, "cpsr: "); _printPSR(be, cpu->cpsr); int instructionLength; enum ExecutionMode mode = cpu->cpsr.t;
M src/lr35902/debugger/cli-debugger.csrc/lr35902/debugger/cli-debugger.c

@@ -21,7 +21,7 @@ { 0, 0, 0, 0 }

}; static inline void _printFlags(struct CLIDebuggerBackend* be, union FlagRegister f) { - be->printf(be, "[%c%c%c%c]\n", + be->printf(be, "F: [%c%c%c%c]\n", f.z ? 'Z' : '-', f.n ? 'N' : '-', f.h ? 'H' : '-',

@@ -82,16 +82,16 @@

static void _printStatus(struct CLIDebuggerSystem* debugger) { struct CLIDebuggerBackend* be = debugger->p->backend; struct LR35902Core* cpu = debugger->p->d.core->cpu; - be->printf(be, "A: %02X F: %02X (AF: %04X)\n", cpu->a, cpu->f.packed, cpu->af); - be->printf(be, "B: %02X C: %02X (BC: %04X)\n", cpu->b, cpu->c, cpu->bc); - be->printf(be, "D: %02X E: %02X (DE: %04X)\n", cpu->d, cpu->e, cpu->de); - be->printf(be, "H: %02X L: %02X (HL: %04X)\n", cpu->h, cpu->l, cpu->hl); - be->printf(be, "PC: %04X SP: %04X\n", cpu->pc, cpu->sp); + be->printf(be, "A: %02X F: %02X (AF: %04X)\n", cpu->a, cpu->f.packed, cpu->af); + be->printf(be, "B: %02X C: %02X (BC: %04X)\n", cpu->b, cpu->c, cpu->bc); + be->printf(be, "D: %02X E: %02X (DE: %04X)\n", cpu->d, cpu->e, cpu->de); + be->printf(be, "H: %02X L: %02X (HL: %04X)\n", cpu->h, cpu->l, cpu->hl); + be->printf(be, "PC: %04X SP: %04X\n", cpu->pc, cpu->sp); struct LR35902Debugger* platDebugger = (struct LR35902Debugger*) debugger->p->d.platform; size_t i; for (i = 0; platDebugger->segments[i].name; ++i) { - be->printf(be, "%s%s: %02X", i ? " " : "", platDebugger->segments[i].name, cpu->memory.currentSegment(cpu, platDebugger->segments[i].start)); + be->printf(be, "%s%s: %02X", i ? " " : "", platDebugger->segments[i].name, cpu->memory.currentSegment(cpu, platDebugger->segments[i].start)); } if (i) { be->printf(be, "\n");
M src/lr35902/debugger/debugger.csrc/lr35902/debugger/debugger.c

@@ -213,10 +213,10 @@ disPtr[1] = ' ';

disPtr += 2; LR35902Disassemble(&info, disPtr, sizeof(disassembly) - (disPtr - disassembly)); - *length = snprintf(out, *length, "A: %02X F: %02X B: %02X C: %02X D: %02X E: %02X H: %02X L: %02X SP: %04X PC: %04X | %s", + *length = snprintf(out, *length, "A: %02X F: %02X B: %02X C: %02X D: %02X E: %02X H: %02X L: %02X SP: %04X PC: %02X:%04X | %s", cpu->a, cpu->f.packed, cpu->b, cpu->c, cpu->d, cpu->e, cpu->h, cpu->l, - cpu->sp, cpu->pc, disassembly); + cpu->sp, cpu->memory.currentSegment(cpu, cpu->pc), cpu->pc, disassembly); } bool LR35902DebuggerGetRegister(struct mDebuggerPlatform* d, const char* name, int32_t* value) {