Skip to content

Advanced concepts

Here are some of the more advanced concepts regarding Cairo Debugger.

Debug configuration in VSCode

As an alternative to ▶ Debug Test code lens, you can create your custom configuration in .vscode/launch.json, for example:

json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cairo",
            "request": "launch",
            "name": "my_pkg::tests::my_test debug",
            "program": "snforge test --package my_pkg --launch-debugger --exact my_pkg::tests::my_test",
            "processCwd": "${workspaceFolder}"
        }
    ]
}

and use the Run and Debug view (Ctrl+Shift+D / Cmd+Shift+D):

Configuration attributes

AttributeTypeReqDescription
typestringMust be "cairo". Identifies the debugger type to VS Code.
requeststringMust be "launch" - "attach" is not supported.
namestringDisplay name shown in the Run and Debug view.
programstringCommand used to start the debug session. The first whitespace-delimited token is the executable; the remaining tokens are passed as arguments. Example: snforge test --launch-debugger --exact my_pkg::tests::my_test.
processCwdstringWorking directory for program. Defaults to the first workspace folder.
logLevel"off" | "error" | "warn" | "info" | "debug" | "trace"Verbosity of the debugger adapter logs. Defaults to "warn".
programExtraEnvobjectExtra environment variables passed to program. Keys are variable names; values must be strings or numbers.

You can read more about debug configurations here.