Open bobbrow opened 2 years ago
Similar situation here and I think this is not really vscode-cmake-tools
issue. gdb
is not supposed to run elevated executable - unless debugger itself is also started with elevated permissions.
So, I start gdb
from vscode
via shell script. In that script I elevate gdb, requesting sudo password. It all works like this:
launch.json
entry:
{
"name": "sudo myapp",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
"-C",
"${workspaceFolder}/config/development.ini"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"miDebuggerPath": "${workspaceFolder}/bin/sudo_gdb.sh",
"MIMode": "gdb"
}
bin/sudo_gdb.sh
contents:
pkexec /usr/bin/gdb "$@"
Hope it helps.
this was working for me until recent updates which broke everything. still unable to find away to run the debugger using sudo. Any idea?
https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md
update: for some reason C/C++ required re-install Name: C/C++ Id: ms-vscode.cpptools Description: C/C++ IntelliSense, debugging, and code browsing. Version: 1.18.5 Publisher: Microsoft VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools
Discussed in https://github.com/microsoft/vscode-cmake-tools/discussions/2445