aboutsummaryrefslogtreecommitdiff
path: root/src/target/smp.c
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2013-01-31 17:01:19 +0000
committerØyvind Harboe <oyvindharboe@gmail.com>2013-02-26 20:49:49 +0000
commit3d62c3df6ddb09f1485c25d665e248856989d180 (patch)
treef4bd01d270d85f49f1f9876abedea4195fd5ec68 /src/target/smp.c
parent80f78acf7350ca9f812b520ec80f9bc6159d7f0c (diff)
gdbserver: use common hexify/unhexify routines
Change-Id: I9989b625666e9c60ec9867cf6f4d94f41c998c3f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1105 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'src/target/smp.c')
-rw-r--r--src/target/smp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/target/smp.c b/src/target/smp.c
index ccbc2be4..66dbfec1 100644
--- a/src/target/smp.c
+++ b/src/target/smp.c
@@ -28,6 +28,7 @@
#include "server/gdb_server.h"
#include "smp.h"
+#include "helper/binarybuffer.h"
/* implementation of new packet in gdb interface for smp feature */
/* */
@@ -53,8 +54,6 @@
/* maint packet Jc01 */
/* maint packet jc */
-static const char DIGITS[16] = "0123456789abcdef";
-
/* packet j :smp status request */
int gdb_read_smp_packet(struct connection *connection,
char *packet, int packet_size)
@@ -68,15 +67,9 @@ int gdb_read_smp_packet(struct connection *connection,
if (strncmp(packet, "jc", 2) == 0) {
hex_buffer = malloc(len * 2 + 1);
buffer = (uint8_t *)&target->gdb_service->core[0];
- uint32_t i;
- for (i = 0; i < 4; i++) {
- uint8_t t = buffer[i];
- hex_buffer[2 * i] = DIGITS[(t >> 4) & 0xf];
- hex_buffer[2 * i + 1] = DIGITS[t & 0xf];
- }
-
- retval = gdb_put_packet(connection, hex_buffer, len * 2);
+ int pkt_len = hexify(hex_buffer, (char *)buffer, len, len * 2 + 1);
+ retval = gdb_put_packet(connection, hex_buffer, pkt_len);
free(hex_buffer);
}
} else