aboutsummaryrefslogtreecommitdiff
path: root/src/gdb_packet.c
diff options
context:
space:
mode:
authorGareth McMullin2011-12-18 17:01:10 +1300
committerGareth McMullin2011-12-18 17:01:10 +1300
commita73f06c14782ab8e0179058c70b7b3c4f6b6695e (patch)
tree796ad4bc722f0dec525742f5bd2f4dda65d0814a /src/gdb_packet.c
parent8061205260f738dc5a2be2706afe35fd12e59dd5 (diff)
Cleaned up debug output on linux build.
Diffstat (limited to 'src/gdb_packet.c')
-rw-r--r--src/gdb_packet.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gdb_packet.c b/src/gdb_packet.c
index 1baf559..958572c 100644
--- a/src/gdb_packet.c
+++ b/src/gdb_packet.c
@@ -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, ...)