X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Fsmp.c;h=66dbfec16c8f634b95395c7c3732a539c637f3e2;hp=ccbc2be434916998ac5692df499a74b132ba4af1;hb=3d62c3df6ddb09f1485c25d665e248856989d180;hpb=80f78acf7350ca9f812b520ec80f9bc6159d7f0c diff --git a/src/target/smp.c b/src/target/smp.c index ccbc2be434..66dbfec16c 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