Vscode-cpptools: Debug Code That Uses Meson & Ninja

Created on 4 Feb 2020  Â·  1Comment  Â·  Source: microsoft/vscode-cpptools

  • OS and Version: Linux Mint 19.3 Tricia
  • VS Code Version: 1.41.1
  • C/C++ Extension Version: 0.26.3

I want to debug Nemo source code using VSCode.

The way we do it using command line is mentioned in https://github.com/linuxmint/nemo/issues/2309

The summery of the process is -

git clone https://github.com/linuxmint/nemo
cd nemo
sudo apt-get build-dep nemo 
dpkg-buildpackage 
cd .. && sudo dpkg -i *.deb

One thing we do to save time after the initial build and install using dpkg-buildpackage, is instead run: sudo ninja -C debian/build install

Currently we are using gdb to debug, & G_BREAKPOINT() to set breakpoints. However, it will be great to put breakpoints and press F5 to debug in VSCode. What might be the best possible way to achieve this?

Please let me know if you need any further information to help us with this process.

Feature Request debugger

Most helpful comment

Hi. It's not Nemo but a different project that was build with Meson in mind that I'm currently working on.
To use the breakpoints in vscode I editied the task.json and launch.json files within the .vscode folder.

launch.json:

{
    "configurations": [
        {
            "name": "Debug with Meson",
            "type": "gdb",
            "request": "launch",
            "target": "./build/Foobar",
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "build debug meson"
        }
    ]
}

task.json:

{
    "tasks": [
        {
            "label": "build debug meson",
            "type": "shell",
            "command": "meson build --buildtype=debug && cd build && ninja"
        }
    ],
    "version": "2.0.0"
}

>All comments

Hi. It's not Nemo but a different project that was build with Meson in mind that I'm currently working on.
To use the breakpoints in vscode I editied the task.json and launch.json files within the .vscode folder.

launch.json:

{
    "configurations": [
        {
            "name": "Debug with Meson",
            "type": "gdb",
            "request": "launch",
            "target": "./build/Foobar",
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "build debug meson"
        }
    ]
}

task.json:

{
    "tasks": [
        {
            "label": "build debug meson",
            "type": "shell",
            "command": "meson build --buildtype=debug && cd build && ninja"
        }
    ],
    "version": "2.0.0"
}
Was this page helpful?
0 / 5 - 0 ratings