gdb: use strncmp rather than strstr
All the packets received will be at start of the packet buffer, so use more efficient strncmp. Change-Id: Ib9c45d8f53425367006b1f880c1bde27f03a6cf9 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/932 Tested-by: jenkins Reviewed-by: Matthias Blaicher <matthias@blaicher.com> Reviewed-by: Peter Stuge <peter@stuge.se>
This commit is contained in:
committed by
Peter Stuge
parent
6f65045b37
commit
538a86c339
@@ -65,7 +65,7 @@ int gdb_read_smp_packet(struct connection *connection,
|
||||
char *hex_buffer;
|
||||
int retval = ERROR_OK;
|
||||
if (target->smp) {
|
||||
if (strstr(packet, "jc")) {
|
||||
if (strncmp(packet, "jc", 2) == 0) {
|
||||
hex_buffer = malloc(len * 2 + 1);
|
||||
buffer = (uint8_t *)&target->gdb_service->core[0];
|
||||
uint32_t i;
|
||||
@@ -95,7 +95,7 @@ int gdb_write_smp_packet(struct connection *connection,
|
||||
|
||||
/* skip command character */
|
||||
if (target->smp) {
|
||||
if (strstr(packet, "Jc")) {
|
||||
if (strncmp(packet, "Jc", 2) == 0) {
|
||||
packet += 2;
|
||||
coreid = strtoul(packet, &separator, 16);
|
||||
target->gdb_service->core[1] = coreid;
|
||||
|
||||
Reference in New Issue
Block a user