thermosphere: gdb: fix a few bugs

This commit is contained in:
TuxSH
2020-02-01 14:25:12 +00:00
parent 86eaa7777b
commit eff433f62c
5 changed files with 14 additions and 12 deletions

View File

@@ -166,9 +166,14 @@ int GDB_ReceivePacket(GDBContext *ctx)
}
switch (hdr) {
case '+':
// Ack, don't do anything else (if allowed)
case '+': {
// Ack, don't do anything else except maybe NoAckMode state transition
if (ctx->noAckSent) {
ctx->flags |= GDB_FLAG_NOACK;
ctx->noAckSent = false;
}
return 0;
}
case '-':
// Nack, return the previous packet
transportInterfaceWriteData(iface, ctx->buffer, ctx->lastSentPacketSize);
@@ -231,14 +236,11 @@ int GDB_ReceivePacket(GDBContext *ctx)
ctx->state = GDB_STATE_ATTACHED;
}
if (ctx->noAckSent) {
ctx->flags |= GDB_FLAG_NOACK;
ctx->noAckSent = false;
}
// Set helper attributes, change '#' to NUL
ctx->commandData = ctx->buffer + 2;
ctx->commandEnd = ctx->buffer + delimPos;
ctx->buffer[delimPos] = '\0';
DEBUG("Packet: %s\n", ctx->buffer + 1);
return (int)(delimPos + 2);
}