X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Frtos%2Frtos.c;h=74e8724e3ffe6e85110ee99c4a65061bc66a1263;hb=e175f027151b11549dba56d8892977ee2ae8aa5d;hp=d69127e5e424d26abd9650b622bfc3616e8b50a3;hpb=6349a47ebc860681e4dbf3bffa31273c911dc7dd;p=openocd.git diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index d69127e5e4..74e8724e3f 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -38,11 +38,13 @@ static int str_to_hex( char* hex_dst, char* src ); /* RTOSs */ extern struct rtos_type FreeRTOS_rtos; extern struct rtos_type ThreadX_rtos; +extern struct rtos_type eCos_rtos; static struct rtos_type *rtos_types[] = { &ThreadX_rtos, &FreeRTOS_rtos, + &eCos_rtos, NULL }; @@ -126,8 +128,10 @@ int rtos_create(Jim_GetOptInfo *goi, struct target * target) -int gdb_thread_packet(struct connection *connection, struct target *target, char *packet, int packet_size) +int gdb_thread_packet(struct connection *connection, char *packet, int packet_size) { + struct target *target = get_target_from_connection(connection); + if (strstr(packet, "qP")) { #define TAG_THREADID 1 /* Echo the thread identifier */ @@ -312,15 +316,14 @@ int gdb_thread_packet(struct connection *connection, struct target *target, char int symbol_num; char* found = strstr( packet, "qSymbol::" ); - int numconv; if (0 == found ) { - numconv =sscanf(packet, "qSymbol:%" SCNx64 ":%s", &value, hex_name_str); + sscanf(packet, "qSymbol:%" SCNx64 ":%s", &value, hex_name_str); } else { // No value returned by GDB - symbol was not found - numconv =sscanf(packet, "qSymbol::%s", hex_name_str); + sscanf(packet, "qSymbol::%s", hex_name_str); } name_str = (char*) malloc( 1+ strlen(hex_name_str) / 2 ); @@ -451,7 +454,17 @@ int gdb_thread_packet(struct connection *connection, struct target *target, char } else if (strstr(packet, "qC")) { - gdb_put_packet(connection, "QC0", 3); + if( target->rtos!=NULL ) + { + char buffer[15]; + int size; + size = snprintf(buffer, 15, "QC%08X", (int)target->rtos->current_thread); + gdb_put_packet(connection, buffer, size); + } + else + { + gdb_put_packet(connection, "QC0", 3); + } return ERROR_OK; } else if ( packet[0] == 'T' ) // Is thread alive? @@ -490,10 +503,12 @@ int gdb_thread_packet(struct connection *connection, struct target *target, char return GDB_THREAD_PACKET_NOT_CONSUMED; } -int rtos_get_gdb_reg_list(struct connection *connection, struct target *target, struct reg **reg_list[], int *reg_list_size) +int rtos_get_gdb_reg_list(struct connection *connection, struct reg **reg_list[], int *reg_list_size) { + struct target *target = get_target_from_connection(connection); + if ( ( target->rtos != NULL ) && - ( current_threadid != 1 ) && + ( current_threadid != -1 ) && ( current_threadid != 0 ) && ( current_threadid != target->rtos->current_thread ) ) {