# Multi-threaded RTOS debug

For the case of debugging with RTOS, CLion provides a view of [FreeRTOS](https://www.freertos.org/), [Azure RTOS](https://azure.microsoft.com/en-us/products/rtos/), and [Zephyr](https://zephyrproject.org/) tasks (threads). For FreeRTOS, you can also explore [objects](#rtos-objects) and [heap](#rtos-heap).

> **Tip:**
> Some gdbservers have built-in support for different RTOS. For CLion integration to work correctly in such cases, make sure to disable the built-in support on the gdbserver side.

Procedure: Enable RTOS thread view

1. Go to `Settings | Build, Execution, Deployment | Embedded Development | RTOS Integration`.

2. Set the Enable RTOS Integration checkbox and select from the list of options:

![Enabling RTOS Integration](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_integration_enable.png)

> **Note:**
> Note that RTOS integration requires GDB 7.4 or later with Python support. You can use CLion's bundled GDB for that, refer to [Switching between the debuggers](configuring-debugger-options.html#select-debugger).

RTOS integration is intended to work for any relevant [run/debug configuration](run-debug-configuration.html), such as [Embedded GDB Server](embedded-gdb-server.html) or [OpenOCD Download &amp; Run](openocd-support.html#opecocd-debug).

For example, here is how an Embedded GDB Server configuration can be set up using the [QEMU](https://www.qemu.org/) emulator:

![Embedded GDB Server configuration example](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_qemu_config.png)

## FreeRTOS / Azure RTOS / Zephyr tasks view

When debugging a configuration like the one given above, you will see the FreeRTOS / Azure RTOS / Zephyr tasks listed in the Threads & Variables pane of the [debug tool window](debug-tool-window.html).

![FreeRTOS thread view](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_debug_threadview.png)

For each task, the variables are presented in the Variables pane.

The RTOS tasks view also works for [Symmetric Multiprocessing (SMP)](https://en.wikipedia.org/wiki/Symmetric_multiprocessing). The processor cores must be identical and share the same memory.

> **Note:**
> If you are working with Zephyr, make sure to set `CONFIG_THREAD_MONITOR` and `CONFIG_THREAD_NAME` in your project configuration files, otherwise the debugger will not be able to extract the required information. CLion will notify you in case of missing defines:
>
> ![Zephyr configuration parameters missing](https://resources.jetbrains.com/help/img/idea/2026.2/cl_zephyr_notification.png)

## FreeRTOS objects view

To explore FreeRTOS objects, switch to the FreeRTOS Objects tab. The Task table shows a list of tasks with status information; the Queue table shows currently active queues, semaphores, and mutexes; the Timer table lists the software timers:

![FreeRTOS Objects view](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_objectsview.png)

For this tab to work correctly, configure the following definitions in `FreeRTOSConfig.h`:

* Set `configUSE_TRACE_FACILITY` to 1, for displaying task numbers and queue types.

* Set `configMAX_TASK_NAME_LEN` to a value greater than zero, for displaying the task name properly.

* Set `configRECORD_STACK_HIGH_ADDRESS` to 1, for displaying the task stack info.

* Set `configUSE_TRACE_FACILITY` and `configGENERATE_RUN_TIME_STATS` to 1 for collecting runtime info (runtime column of the task table).

* Use `configQUEUE_REGISTRY_SIZE` greater than zero and `vQueueAddToRegistry()` to assign a name to a queue, semaphore, or mutex. This is useful as queues have no name by default, unlike tasks (which get a name at creation time).

CLion will show a warning in case some of the defines are missing:

![FreeRTOS defines missing](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_defines_warning.png)

## FreeRTOS heap view

The FreeRTOS Heap tab shows the current heap usage and memory block allocation for all the default FreeRTOS memory management schemes.

> **Note:**
> For [heap_5](https://www.freertos.org/a00111.html) to be supported properly, make sure to define the `xHeapRegions` variable in global scope, for example:
>
>
> ```CPLUSPLUS
> HeapRegion_t xHeapRegions[] = {
> { &heap_sram_lower1[0], sizeof(heap_sram_lower1)},
> { &heap_sram_lower2[0], sizeof(heap_sram_lower2)},
> {NULL, 0}
> };
> int main( void ) {...}
> ```

![FreeRTOS Heap view](https://resources.jetbrains.com/help/img/idea/2026.2/cl_rtos_heapview.png)

## See also

### Procedures

[Embedded development](embedded-overview.html) [Embedded GDB Server](embedded-gdb-server.html) [OpenOCD support](openocd-support.html) [Debug](debugging-code.html)

### How tos

[Device tree files](dts-support.html) [Linker scripts](language-support-for-linker-scripts.html)

