X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Frtos%2Flinux.c;h=9c955972a8469b056e168d0c0883e947739a725f;hp=15d52366fb83d9fa7a92223cb090c71c69ec0054;hb=e89cae8dbc79e8ed2e894cad83773e30db190135;hpb=60a932b36804bff8b6ca40adc665a33a59475db1 diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 15d52366fb..9c955972a8 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -28,8 +28,8 @@ #include "target/target.h" #include "target/target_type.h" #include "helper/log.h" +#include "helper/types.h" #include "rtos.h" -#include "helper/log.h" #include "rtos_standard_stackings.h" #include #include "server/gdb_server.h" @@ -326,9 +326,9 @@ static int linux_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) { unsigned int i; *symbol_list = (symbol_table_elem_t *) - malloc(sizeof(symbol_table_elem_t) / sizeof(char *)); + malloc(sizeof(symbol_table_elem_t) * ARRAY_SIZE(linux_symbol_list)); - for (i = 0; i < sizeof(linux_symbol_list) / sizeof(char *); i++) + for (i = 0; i < ARRAY_SIZE(linux_symbol_list); i++) (*symbol_list)[i].symbol_name = linux_symbol_list[i]; return 0; @@ -1396,10 +1396,8 @@ 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) { - gdb_put_packet(connection, "OK", 2); - linux_compute_virt2phys(target, target->rtos-> symbols[INIT_TASK]. @@ -1407,7 +1405,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, @@ -1421,10 +1419,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;