X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Frtos%2Flinux.c;h=68b2d1d2faec84792bd9ae752b78859856f2a072;hp=3f1b214bc54f81e3bbc28e3dc70f622b96fb47d0;hb=3d62c3df6ddb09f1485c25d665e248856989d180;hpb=a4dc39beb4c5678476d40e4e13f0a79d45145460 diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 3f1b214bc5..68b2d1d2fa 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -1217,7 +1217,7 @@ int linux_thread_extra_info(struct target *target, char *tmp_str = (char *)calloc(1, str_size + 50); char *tmp_str_ptr = tmp_str; - /* discriminate cuurent task */ + /* discriminate current task */ if (temp->status == 3) tmp_str_ptr += sprintf(tmp_str_ptr, "%s", pid_current); @@ -1229,10 +1229,9 @@ int linux_thread_extra_info(struct target *target, tmp_str_ptr += sprintf(tmp_str_ptr, "%s", " | "); sprintf(tmp_str_ptr, "%s", name); sprintf(tmp_str_ptr, "%s", temp->name); - char *hex_str = - (char *)calloc(1, strlen(tmp_str) * 2 + 1); - str_to_hex(hex_str, tmp_str); - gdb_put_packet(connection, hex_str, strlen(hex_str)); + char *hex_str = (char *)calloc(1, strlen(tmp_str) * 2 + 1); + int pkt_len = hexify(hex_str, tmp_str, 0, strlen(tmp_str) * 2 + 1); + gdb_put_packet(connection, hex_str, pkt_len); free(hex_str); free(tmp_str); return ERROR_OK; @@ -1396,7 +1395,7 @@ static int linux_thread_packet(struct connection *connection, char *packet, break; case 'q': - if ((strstr(packet, "qSymbol"))) { + if (strncmp(packet, "qSymbol", 7) == 0) { if (rtos_qsymbol(connection, packet, packet_size) == 1) { linux_compute_virt2phys(target, target->rtos-> @@ -1405,7 +1404,7 @@ static int linux_thread_packet(struct connection *connection, char *packet, } break; - } else if (strstr(packet, "qfThreadInfo")) { + } else if (strncmp(packet, "qfThreadInfo", 12) == 0) { if (linux_os->thread_list == NULL) { retval = linux_gdb_thread_packet(target, connection, @@ -1419,10 +1418,10 @@ static int linux_thread_packet(struct connection *connection, char *packet, packet_size); break; } - } else if (strstr(packet, "qsThreadInfo")) { + } else if (strncmp(packet, "qsThreadInfo", 12) == 0) { gdb_put_packet(connection, "l", 1); break; - } else if (strstr(packet, "qThreadExtraInfo,")) { + } else if (strncmp(packet, "qThreadExtraInfo,", 17) == 0) { linux_thread_extra_info(target, connection, packet, packet_size); break;