When you are set up a build configuration or edit a sysbuild domain, the extension offers two options to enable debugging in the Build Configuration page:
-
Optimize for debugging optimization level that enables debugging features with the
nrf-connectdebug type. When you have this option selected, the following Kconfig options are automatically set:Option Description Valid for CONFIG_DEBUG_OPTIMIZATIONSThis option limits the optimizations made by the compiler to only those that do not impact debugging. - Single build configuration
- Sysbuild main domain<domain_name>_CONFIG_DEBUG_OPTIMIZATIONSSame use as CONFIG_DEBUG_OPTIMIZATIONSbut for sysbuild domains other than the main domain. This is because of configuration namespacing in Sysbuild.- Sysbuild other domains This optimization level also lets you see the memory content in the Memory Explorer.
-
Include debug thread information option that includes thread information in the build (enabled by default). This option sets the following Kconfig options:
Option Description Valid for CONFIG_DEBUG_THREAD_INFOThis option adds additional information to the thread object so that the debugger can discover the threads. This will work for any debugger Additional threads appear in the Call Stack View. - Single build configuration
- Sysbuild main domain<domain_name>_CONFIG_DEBUG_THREAD_INFOSame use as CONFIG_DEBUG_THREAD_INFObut for sysbuild domains other than the main domain. This is because of configuration namespacing in Sysbuild.- Sysbuild other domains This option also lets you see threads in the Thread Viewer, but the Viewer is only available when the Optimize for debugging optimization level is also selected.
Tip
To enable the full set of debugging options for your nRF Connect SDK application, set both Optimize for debugging and Include debug thread information.
Enabling the debugging options affects the application's memory usage, so make sure to fine-tune the stack sizes of your threads for debugging.
Similarly, some elements of application configuration might conflict with debugging. For example, if you enabled Link Time Optimization (CONFIG_LTO), you might need to disable it for debugging to work correctly. The extension warns you if this is the case.
Note
By default, the nrf-connect.debugging.justMyCode setting shows the internal functions of Zephyr and the nRF Connect SDK in Call Stack. Change the setting to true in application settings if you want to hide these internal functions.