Cleaned up debug output on linux build.

This commit is contained in:
Gareth McMullin 2011-12-18 17:01:10 +13:00
parent 8061205260
commit a73f06c147
2 changed files with 25 additions and 4 deletions

View File

@ -69,7 +69,6 @@ gdb_main(void)
SET_IDLE_STATE(1);
size = gdb_getpacket(pbuf, BUF_SIZE);
SET_IDLE_STATE(0);
DEBUG("%s\n", pbuf);
switch(pbuf[0]) {
/* Implementation of these is mandatory! */
case 'g': { /* 'g': Read general registers */
@ -287,7 +286,7 @@ gdb_main(void)
}
default: /* Packet not implemented */
DEBUG("Unsupported packet: %s\n", pbuf);
DEBUG("*** Unsupported packet: %s\n", pbuf);
gdb_putpacket("", 0);
}
}

View File

@ -79,6 +79,18 @@ gdb_getpacket(unsigned char *packet, int size)
}
gdb_if_putchar('+', 1); /* send ack */
packet[i] = 0;
#ifdef DEBUG_GDBPACKET
DEBUG("%s : ", __func__);
for(int j = 0; j < i; j++) {
c = packet[j];
if ((c >= 32) && (c < 127))
DEBUG("%c", c);
else
DEBUG("\\x%02X", c);
}
DEBUG("\n");
#endif
return i;
}
@ -91,10 +103,19 @@ void gdb_putpacket(unsigned char *packet, int size)
int tries = 0;
do {
#ifdef DEBUG_GDBPACKET
DEBUG("%s : ", __func__);
#endif
csum = 0;
gdb_if_putchar('$', 0);
for(i = 0; i < size; i++) {
c = packet[i];
#ifdef DEBUG_GDBPACKET
if ((c >= 32) && (c < 127))
DEBUG("%c", c);
else
DEBUG("\\x%02X", c);
#endif
if((c == '$') || (c == '#') || (c == '}')) {
gdb_if_putchar('}', 0);
gdb_if_putchar(c ^ 0x20, 0);
@ -108,9 +129,10 @@ void gdb_putpacket(unsigned char *packet, int size)
sprintf(xmit_csum, "%02X", csum);
gdb_if_putchar(xmit_csum[0], 0);
gdb_if_putchar(xmit_csum[1], 1);
#ifdef DEBUG_GDBPACKET
DEBUG("\n");
#endif
} while((gdb_if_getchar_to(2000) != '+') && (tries++ < 3));
}
void gdb_putpacket_f(const unsigned char *fmt, ...)