ioutil: make the file compile on MacOS
[fw/openocd] / src / rtos / rtos.c
index 9002f1a8cfe64960785063465453d90f4eb12630..00025abeef83c0222856b2666cd260aef538d774 100644 (file)
@@ -34,12 +34,14 @@ extern struct rtos_type FreeRTOS_rtos;
 extern struct rtos_type ThreadX_rtos;
 extern struct rtos_type eCos_rtos;
 extern struct rtos_type Linux_os;
+extern struct rtos_type ChibiOS_rtos;
 
 static struct rtos_type *rtos_types[] = {
        &ThreadX_rtos,
        &FreeRTOS_rtos,
        &eCos_rtos,
        &Linux_os,
+       &ChibiOS_rtos,
        NULL
 };
 
@@ -194,6 +196,9 @@ int rtos_qsymbol(struct connection *connection, char *packet, int packet_size)
 
        reply_len = sprintf(reply, "OK");
 
+       if (!os)
+               goto done;
+
        if (sscanf(packet, "qSymbol:%" SCNx64 ":", &addr))
                hex_to_str(cur_sym, strchr(packet + 8, ':') + 1);
        else if (target->rtos_auto_detect && !rtos_try_next(target))
@@ -339,9 +344,9 @@ int rtos_thread_packet(struct connection *connection, char *packet, int packet_s
                return ERROR_OK;
        } else if (strstr(packet, "qC")) {
                if (target->rtos != NULL) {
-                       char buffer[15];
+                       char buffer[19];
                        int size;
-                       size = snprintf(buffer, 15, "QC%08X", (int)target->rtos->current_thread);
+                       size = snprintf(buffer, 19, "QC%016" PRIx64, target->rtos->current_thread);
                        gdb_put_packet(connection, buffer, size);
                } else
                        gdb_put_packet(connection, "QC0", 3);