all repos — mgba @ d97976d0df9dd8a30b6e82db369084b910fd1d00

mGBA Game Boy Advance Emulator

Add stepping and clean up
Jeffrey Pfau jeffrey@endrift.com
Sat, 01 Feb 2014 15:50:12 -0800
commit

d97976d0df9dd8a30b6e82db369084b910fd1d00

parent

325380989cec960668ba43d008f710c82e1cac11

1 files changed, 14 insertions(+), 2 deletions(-)

jump to
M src/debugger/gdb-stub.csrc/debugger/gdb-stub.c

@@ -150,7 +150,6 @@ }

stub->outgoing[i] = '#'; _int2hex8(checksum, &stub->outgoing[i + 1]); stub->outgoing[i + 3] = 0; - printf("> %s\n", stub->outgoing); send(stub->connection, stub->outgoing, i + 3, 0); }

@@ -175,6 +174,15 @@ }

fcntl(stub->connection, F_SETFL, flags | O_NONBLOCK); } // TODO: parse message + (void) (message); +} + +static void _step(struct GDBStub* stub, const char* message) { + ARMRun(stub->d.cpu); + snprintf(stub->outgoing, GDB_STUB_MAX_LINE - 4, "S%02x", SIGINT); + _sendMessage(stub); + // TODO: parse message + (void) (message); } static void _readMemory(struct GDBStub* stub, const char* message) {

@@ -258,6 +266,7 @@ _sendMessage(stub);

} static void _processVWriteCommand(struct GDBStub* stub, const char* message) { + (void) (message); stub->outgoing[0] = '\0'; _sendMessage(stub); }

@@ -280,6 +289,7 @@ unsigned i = 0;

uint32_t address = _readHex(readAddress, &i); readAddress += i + 1; uint32_t kind = _readHex(readAddress, &i); // We don't use this in hardware watchpoints + (void) (kind); ARMDebuggerSetBreakpoint(&stub->d, address); strncpy(stub->outgoing, "OK", GDB_STUB_MAX_LINE - 4); _sendMessage(stub);

@@ -316,7 +326,6 @@

size_t _parseGDBMessage(struct GDBStub* stub, const char* message) { uint8_t checksum = 0; int parsed = 1; - printf("< %s\n", stub->line); switch (*message) { case '+': stub->lineAck = GDB_ACK_RECEIVED;

@@ -391,6 +400,9 @@ _processQWriteCommand(stub, message);

break; case 'q': _processQReadCommand(stub, message); + break; + case 's': + _step(stub, message); break; case 'V': _processVWriteCommand(stub, message);