3

i've got a trouble. Can't debug my program remotly due to can't call wiringPiSetupGpio(). I'm using netbeans to develop and debug my programs. I'm almost sure I need run debugging as root user but... how can I do that?

Is it possible to force netbeans start something like 'sudo gdb' insead of normal user? Or maybe to force my account in raspberry pi to call 'sudo gdb' when whatever try to call 'gdb'?

Puchacz
  • 1,987
  • 2
  • 24
  • 38
  • I've asked similar question: http://stackoverflow.com/questions/23893326/debugging-a-c-program-in-netbeans-8-0-which-needs-the-sudo-to-run - and got no answers (even after 50 bounty). But - in my situation the `Raspberry Pi` was not involved – HEKTO Aug 10 '14 at 00:07

2 Answers2

0

To force netbeans start gdb as root, you need to install netbeans as root. make sure your netbeans intall dir is in /usr/local and not in /home/[user_name]. You have to run netbeans installation as sudo

Mahouk
  • 902
  • 9
  • 28
0

This is an old post but since I was facing the same issue I will post how I resolved this:

The problem for me did not seem to be the gdb, but the gdbserver running on the Raspi (or Beaglebone in my case).

I added a debug configuration to debug the application as root, therefore I added a script to the Beaglebone /usr/local/sbin/gdbserver and added the following lines:

#!/bin/bash
sudo /usr/bin/gdbserver $* 

and made it executable:

sudo chmod a+x /usr/local/sbin/gdbserver 

and see that in the file /etc/login.defs the lines

ENV_SUPATH PATH= .... 
ENV_PATH   PATH= .... 

contain /usr/local/sbin. then in the debug configuration for the root execution I changed the command gdbserver to /usr/local/sbin/gdbserver. If that still doesn't work you might have to do this too:

sudo visudo

and add

<your_user> ALL=(root) NOPASSWD:/usr/bin/gdbserver 

I hope this helps.

David Wright
  • 464
  • 6
  • 18