Skip to content

Instantly share code, notes, and snippets.

@leogr
Created March 19, 2021 17:05
Show Gist options
  • Save leogr/5f6916353bca6ee9c51db2142ba5981e to your computer and use it in GitHub Desktop.
Save leogr/5f6916353bca6ee9c51db2142ba5981e to your computer and use it in GitHub Desktop.
GDB with sudo
#!/bin/sh
pkexec /usr/bin/gdb "$@"

Create /usr/bin/gdbsudo

  1. Copy gdbsudo to /usr/bin/gdbsudo
  2. chmod +x /usr/bin/gdbsudo
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdbsudo) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/path/to/your/program",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdbsudo",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment