Reputation: 4269
I have written some python C++ extension that I want to debug while running it from python (interactively) using Visual Studio Code on Linux.
I have set-up my launch.json as follows for attach. Basically it is using my python interpreter as the program
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "/home/mike/.pyenv/versions/anaconda3/bin/python",
"processId": "${command:pickProcess}",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
Unfortunately, nothing happens. I am pretty new to Visual Studio Code for debugging, so I might be missing something trivial.
Upvotes: 0
Views: 1405
Reputation: 51
You could also use the VScode extension "Python C++ Debug". It automatically attaches the C++ debugger to the python debugger for you. Also if you don't have a launch.json file ready, it sets up all configurations you need when clicking on 'create a launch.json file'.
Upvotes: 1
Reputation: 4269
It was indeed trivial. Just attach the correct process. Keeping the answer here as it is not trivial to find on the web.
Upvotes: 3