Skip to content

Remote Debugging using Visual Studio Code

tobiasjaehnelavl edited this page Feb 16, 2023 · 3 revisions

Working on the CarSimulator code can easily be done using Visual Studio Code as it allows to connect to a RaspberryPi (or WSL) via SSH and remotely editing the code.

When it comes to debugging, you can use the following launch.json. Just put it into the .vscode directory and change the paths and args appropriately. You also need the C/C++ Visual Studio Code extension.

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Car Simulator",
        "type": "cppdbg",
        "request": "launch",
        "program": "/opt/car-simulator/dist/Debug/GNU-Linux/amos-ss17-proj4",
        "args": ["vcan0"],
        "stopAtEntry": false,
        "cwd": "/opt/car-simulator/dist/Debug/GNU-Linux/",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true                },
            {
                "description":  "Set Disassembly Flavor to Intel",
                "text": "-gdb-set disassembly-flavor intel",
                "ignoreFailures": true                }
        ]
    }
]
}

Debugging can then start by pressing _F5 _or selecting Run -> Start Debugging

Clone this wiki locally