Sysprogs forums › Forums › VisualGDB › Debugging target with sudo rights
- This topic has 6 replies, 4 voices, and was last updated 7 years, 4 months ago by dcomer.
-
AuthorPosts
-
March 23, 2013 at 11:17 #509chandaParticipant
Hello
I have setup my raspberry Pi and try to use the GPIO. Almost all efficient libraries like wiringPi or bcm2835 need root access to run. How is it possible to debug such a program?I tried to add commands like
sudo chown 0.0 “binary”
sudo chmod 4777 “binary”in the GDB startup commands, but sudo is not known, e.g. error message during connect Undefined command: “sudo”. Try “help”.
What are the possibilities with VisualGDB?
Thanks
March 23, 2013 at 19:30 #2245supportKeymasterThe easiest way would be to let VisualGDB connect via SSH already as root:
1. Open a root shell with ‘sudo su’
2. Change the root password with ‘passwd’
3. In VisualGDB Project Properties (right-click on the project file to open) find the ‘Remote Computer’ setting, select ‘New connection’ and enter ‘root’ as the user name and the password you set in the previous step.From now on the project will be built and debugged as root.
October 23, 2014 at 13:16 #2247AnonymousParticipantHey,
I want to reheat that question:
What bazis writes works for me, but I would prefer to be able to run with su rights from an (automatically logged in) standard user account.The reason is, my application should have a GUI on lxde and still access root.
Debugging it either leads to (with root):- Invalid MIT-MAGIC-COOKIE-1 myAppName: cannot connect to X server :0
Or (without root):
- wiringPiSetup: Must be root. (Did you forget sudo?)
What works is:
- Taking the application created without root and running it on the lxde desktop with either:
- root: ./myAppName
- pi: sudo ./myAppName
works as intended, just isn’t debugging
TL:DR
I want to know how to debug applications with su rights on a standard users LXDE desktopThanks!
October 25, 2014 at 01:05 #2246supportKeymasterHi,
We’ve added support for running gdb via sudo a few versions ago. See the “run debugger as root with sudo” checkbox on the Debug Settings page.
July 1, 2017 at 20:10 #11631dcomerParticipantSorry, I know that was an old post. I have the same issue, but I do not see “run debugger as root with sudo”. Is this accessable via the VW (2015 in my case) IDE, or a VisualGDB dialog. I’ve looked all over and do not see this option.
Thanks,
Dave
July 2, 2017 at 04:58 #11632supportKeymasterHi,
It should be on the Debug Settings page of VisualGDB Project Properties. If not, please attach a screenshot of this page (we have recently added attaching functionality to the forum) and we will advise.
July 4, 2017 at 17:59 #11645dcomerParticipantAh, got it now. I was looking in the right-click menu for the project. I did not realize that I should have, instead, been right-clicking on the VisualGDB settings project item, looking on the left hand side of the tabbed dialog that says “Debug Settings, and in the middle of tab with the debug settings indeed there is the “Run debugger as root with sudo (this can cause debugging to hang)” check box. I’m being a little verbose in my reply should someone else have the same issue. I’d include an image here but not sure it would remain with my reply.
Thanks for your help. I LOVE VisualGDB. It is perfect for the development I do!
Dave
-
AuthorPosts
- You must be logged in to reply to this topic.