I know that this question was asked many times on various sites, but I couldn't find any recommendations how to fix my problem. I'm working with GCC 4.8.1 in NetBeans 8.0 and need to (visually) debug a program, which accesses raw devices, so I need to run it via sudo.
My project properties settings are:
- Run -> Run Command = "sudo ${OUTPUT_PATH}"
- Run -> Console Type = "External Terminal"
- Run -> External Terminal Type = "Default"
All the other settings are default ones, including Debug -> Debug Command
, which is empty.
So, the program works fine when I run it in NetBeans - sudo asks for a password and then the program continues. However, I can't debug it in the NetBeans - the debugger outputs the text below and stops.
Any ideas? Please don't suggest running the NetBeans as root - it's too troublesome for me.
(I'm on Xubuntu 3.11
, which runs as a guest OS
in the VMWare Fusion VM on Mac)
UPDATE FROM 2015/09/16:
According to multiple advices (from the net) I tried to replace the Debug Command
in the Tools
-> Options
-> C/C++
pop-up window by my script with the following content:
#!/bin/bash
PROG=$(which gdb)
sudo $PROG "$@"
This script works fine from command line. However, when I try to debug my program from NetBeans I get the following pop-up window:
So, the first problem goes away and the second one pops up. I saw a number of recommendations to clear breakpoints in this case - it didn't help me.
Any ideas what to try next?
(The gdb version is GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04)