Skip to content

(Remote) Debugging with VS Code (Linux)

Bart Louwers edited this page Oct 26, 2023 · 1 revision

Here are some notes how I am using using remote (Linux) development and debugging with VS Code. These guides get you started.

Since the server I am using is headless, I needed to use Xvfb.

MapLibre Native could not connect to the X server when I ran Xvfb manually and set the DISPLAY variable.

So instead I ran gdbserver with

xvfb-run -a gdbserver localhost:9999 build/mbgl-benchmark-runner

and added the following launch.json configuration to VS Code:

      {
        "type": "gdb",
        "request": "attach",
        "name": "Attach to gdbserver",
        "executable": "build/mbgl-benchmark-runner",
        "target": "localhost:9999",
        "remote": true,
        "cwd": "${workspaceRoot}", 
        "gdbpath": "/usr/bin/gdb",
    }