Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4777

C/C++ • VS Code, Debugging C++ Remotely on Linux as root (sudo)

$
0
0
Hey All - I'd spent a bunch of time trying to get VS Code to run my C++ program remotely as root (to keep pigpio happy). So thought I'd share.

There's a bunch of different methods proposed across forums, but for C++ I highlight a solution presented by bugraaydogar back in 2017.

"Make a copy of the gdb binary and use a bash script to decorate it."

Code:

cd /usr/binsudo mv gdb gdborig
Then create a new file for gdb containing the following bash script..

Code:

#!/bin/shsudo gdborig $@
To create and edit the file I used nano, you're needing sudo to mess with files here.

Code:

sudo touch gdbsudo nano gdb
This causes anything using your gdb debugger to run as sudo - remember you've done this, be careful.

Statistics: Posted by kevtrousers — Sat May 04, 2024 4:22 am



Viewing all articles
Browse latest Browse all 4777

Trending Articles