I did the following:
- create a script called "gdb" in e.g. my home directory, containing:
pkexec /usr/bin/gdb "$@"
- make it executable
- modify the launch.json in VSCode to call the script (obviously change username accordingly) by adding "miDebuggerPath":
...
"externalConsole": false,
"miDebuggerPath": "/home/<username>/gdb",
"MIMode": "gdb",
...
- whilst debugging, use
top
or such like to verify the process is running as root.
That should be enough.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…