Debugging UI and settings - nRF Connect for VS Code
Skip to content

Debugging UI and settings

VS Code's debugging UI appears when you start debugging an application, along with nRF Connect for VS Code's debugging UI and features.

The following nRF Connect for VS Code debugging UI is available for examining the debugging process:

In addition, when the debugger is running, the debugging toolbar appears at the top of the screen and lets you control the debugging process using the following buttons:

Button Description
Start/Continue Starts or continues the debugging process.
Step over Steps over a function.
Step in Steps into a function.
Step out Steps out of a function.
Restart Restarts the debugging process.
Stop Stops the debugging process.

Launch and debug configuration fields

You can customize the launch and actions of Debug by adding different configuration fields to the launch.json file.

See the customizing launch and debug configurations page for an explanation and example of how to use these configurations.

Tip

You can view the description of these fields in the launch.json file by starting to type out their name, and hovering your cursor over the field name to reveal a tooltip.

Native Visual Studio Code configuration fields

Visual Studio Code provides several native attributes that you can use in the launch.json file to customize the debugging launch and actions. For more information and the full list, read the launch.json attributes in the Visual Studio Code documentation.

Custom launch and debug configuration fields

The following table lists configuration fields specific to the extension that you can use to customize the launch and actions of Debug in the launch.json file.

Field Description Variable type
serverpath Path to the JLinkGDBServerCL executable. Set to null to not launch a new server. This requires that an existing GDB server is already running at the address indicated by serverAddress. String or null
setupCommands Provide a list of GDB commands to be used for setting up the underlying debugger. Use the format described in VS Code's documentation JSON array of objects
serverArgs Override the arguments to pass to the GDB Server. Has four variables available. See below. String
serverAddress Address and port for the GDB server. Use ${port} to insert the auto-selected port passed to the GDB Server. Defaults to 127.0.0.1:${port}. String
svdPath Path to the .svd file describing the device. Leave blank to auto select. String
logging Emit program output. Defaults to true. Has four boolean variable available. See below. Object
gdbPath Path to the GDB executable. String
runToEntryPoint If set, the debugger will run until the start of the given function. String
flash If set, the device will be flashed before each debug session. Boolean
snr The serial number of the board to debug on. If the serial number is incomplete or blank, a list of all connected devices matching the given serial number will be shown. Number or string
memorySections Start address for a custom memory section in the Memory Explorer. Accepts either an integer or a hex string (for example, 0xfff) can be used. See the Memory Explorer guide page for more details. Array
flashBreakpoints Enable flash breakpoints. Defaults to true. Boolean
postRemoteConnectCommands Provide a list of GDB commands to be executed after the debugger has connected to the target. Use the same format as for setupCommands. JSON array of objects

Configuration field arguments

In addition, the debug configuration supports variables that let you reference dynamic concepts that are resolved during the debug session setup.

These variables are inserted in the default string, so that you can easily change the default parameters in the launch.json file.

serverArgs

These variables only apply to the serverArgs field.

Variable Description
${device} The SEGGER J-Link device identifier, for example "nRF52840_xxAA".
${port} An autoselected port allocated for the server on the localhost.
${snr} The serial number of the selected device.
${rtosPlugin} The J-Link Zephyr RTOS plugin location.

logging

These variables only apply to the logging field. All are boolean types.

Variable Description
programOutput Emit program output. Defaults to true.
engineLogging Emit diagnostic engine logs. Defaults to false.
trace Show GDB commands. Defaults to false.
traceResponse Show GDB command responses. Defaults to false.