how to debug a program with root priviledge on eclipse CDT? [message #1710764] |
Fri, 09 October 2015 06:41 |
wen liu Messages: 7 Registered: September 2015 |
Junior Member |
|
|
I'm using ubuntu(linux)
My program uses libpcap to capture packets and so it needs root priviledge.
I searched a solution from Internet
1 Enable your user to run gdb as root without being asked for any password:
sudo visudo
Add the following line after all other rules:
<youruser> ALL=(root) NOPASSWD:/usr/bin/gdb
2 Create or modify a debug configuration in eclipse to run gdb as root
e.g. in Run > Debug Configurations > C/C++ Application > YourProject Debug:
change Debugger > Main > GDB debugger from gdb to sudo -u <youruser> gdb
but this solution doesn't work, I get "Pcap open live capture failure: wlan0: You don't have permission to capture on that device (socket: Operation not permitted)"
what is wrong?
are there any other workaround?
BTW: I don't know how to run the eclipse program itself through terminal. I have two eclipse installed, one is for Java and the other is CDT.
when I run the command "eclipse", I get
esolve@mypad:~$ eclipse
The program 'eclipse' is currently not installed. You can install it by typing:
sudo apt-get install eclipse-platform
is it possible if I can run my CDT eclipse through command line using sudo (something like sudo eclipse), then I CAN debug my program with root priviledge? if so, how?
[Updated on: Fri, 09 October 2015 06:45] Report message to a moderator
|
|
|
|
|
Re: how to debug a program with root priviledge on eclipse CDT? [message #1710819 is a reply to message #1710770] |
Fri, 09 October 2015 14:02 |
Tauno Voipio Messages: 742 Registered: August 2014 |
Senior Member |
|
|
It is always unhealthy to run flaky programs as root.
Did you look at the Wireshark instructions? There are ways to capture without being root.
You should have core dumps from the segmentation faults. Did you look at them with gdb?
If you *have* to run the debug session, do it with gdb alone as root. Please do not forget to compile the program with debug symbols and with optimization turned off.
--
Tauno Voipio
|
|
|
Powered by
FUDForum. Page generated in 0.03141 seconds