Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem(Debug fails: Permission denied /dev/mem)
icon4.gif  Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1693401] Thu, 23 April 2015 19:30 Go to next message
Rick Drolet is currently offline Rick DroletFriend
Messages: 4
Registered: April 2015
Junior Member
System: Windows 7 | VirtualBox | Kubuntu v14.10 Linux 64 bit | Eclipse Luna - SSL link to Raspberry Pi 2 Model B

Forum folks,

When a Debug session is activated that contains access to a GPIO region, the debugger fails to access the GPIO with the needed permissions.

While it seems clear that some permissions are not set correctly, I am at a loss as to how to resolve this issue.

Can someone please assist me with this?

Thanks!


Steps tried w/o success:

Post-build step: chmod -x <program>; before secure copy

launch eclipse as user: eclipse/eclipse
launch eclipse as root: sudo eclipse/eclipse
add sudo -u to launch GDB debugger

used sudo su then launched eclipse

In Remote Debug: GDB debugger as sudo -u <user> /home/<user>/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gdb

stackoverflow.com/questions/2891356/how-to-debug-application-as-root-in-eclipse-in-ubuntu

Edit visudo to add line to enable sudo for the debugger:
<user> ALL=(root) NOPASSWD:/home/<user>/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gdb

Debug/Skip download to target path
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1693611 is a reply to message #1693401] Sun, 26 April 2015 19:20 Go to previous messageGo to next message
Rick Drolet is currently offline Rick DroletFriend
Messages: 4
Registered: April 2015
Junior Member
Could this be a case that no one has experienced this issue?

Or am I asking the wrong question?

To recap: What settings should the GDB Debugger use to allow GPIO single stepping with root privilege?
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1693612 is a reply to message #1693611] Sun, 26 April 2015 19:43 Go to previous messageGo to next message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Rick Drolet wrote on Sun, 26 April 2015 22:20
Could this be a case that no one has experienced this issue?

Or am I asking the wrong question?

To recap: What settings should the GDB Debugger use to allow GPIO single stepping with root privilege?


If you're running the GDB in the host computer and gdbserver agent program in the Pi, the thing needing the privileges is the agent (gdbserver in Pi). I'd start changing the gdbserver in Pi to suid root.

Needless to say, the setup is bad from a security standpoint.


--

Tauno Voipio
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1693613 is a reply to message #1693612] Sun, 26 April 2015 19:45 Go to previous messageGo to next message
Rick Drolet is currently offline Rick DroletFriend
Messages: 4
Registered: April 2015
Junior Member
Thank you for the advise as to where to look!
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1693988 is a reply to message #1693613] Wed, 29 April 2015 20:01 Go to previous messageGo to next message
Rick Drolet is currently offline Rick DroletFriend
Messages: 4
Registered: April 2015
Junior Member
For those that have this problem (needing to debug in root), this is one solution for Eclipse:

1) Create a bash file as usr/local/sbin/gdbserver:

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

2) Change Debug As/Debug Configurations/C/C++ Remote Application/{project}/Debugger/Gdbserver Settings/Gdbserver path: /usr/local/sbin/gdbserver

Yes, this does create a security issue, but at least this enables low-level debug.
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1756399 is a reply to message #1693988] Thu, 16 March 2017 12:10 Go to previous messageGo to next message
Joan Faig is currently offline Joan FaigFriend
Messages: 1
Registered: March 2017
Junior Member
These steps allow you to debug, but is there a way to execute (run) an application from eclipse with sudo?
I mean, you have achieved to execute the debugger server in sudo, but is there a way to execute the application remotely in sudo?
Thanx in advance
Re: Cannot Debug GPIO in (Linux) Eclipse CDT Luna - Debug fails: Permission denied /dev/mem [message #1757859 is a reply to message #1756399] Mon, 20 March 2017 19:39 Go to previous message
Tauno Voipio is currently offline Tauno VoipioFriend
Messages: 742
Registered: August 2014
Senior Member
Joan Faig wrote on Thu, 16 March 2017 14:10

I mean, you have achieved to execute the debugger server in sudo, but is there a way to execute the application remotely in sudo?
Thanx in advance


This is off-topic for Eclipse, rather a general Linux question.

One solution is to change the executable in the Linux machine (Pi) to suid root. There are less rough methods to access the I/O using the Linux capabilities, but the details belong more to a Linux or Pi expert forum.


--

Tauno Voipio
Previous Topic:Add custom page to wizard as starting page
Next Topic:C++ programs beginners
Goto Forum:
  


Current Time: Fri Apr 26 08:54:22 GMT 2024

Powered by FUDForum. Page generated in 0.03697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top