LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2021, 10:17 AM   #1
Senitar
LQ Newbie
 
Registered: Mar 2021
Distribution: Raspberry Pi
Posts: 2

Rep: Reputation: Disabled
Trying to debug a program using DDD/GDB that requires Sudo to run


Hi,

I am a linux novice. I have a Raspberry Pi 4 purchased from CanaKit. The program I have created requires Sudo to run since it attempts to change the scheduler for a threat that it spawns. When I tried to debug it using DDD I get a privilege violation since it seems GDB does not start the program as Sudo. After searching the web for hours, I have not found anything that explains how to get DDD to do this.

Any help will be greatly appreciated

Joe
 
Old 03-29-2021, 11:01 AM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You could set SUID as one possible solution.
 
Old 03-29-2021, 11:31 AM   #3
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Registers today and posts this kind of question? I suspect a TROLL.
A newbie would not be able to write that kind of question/background.
 
Old 03-29-2021, 12:01 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Welcome to LQ Senitar,

Not an everyday suggestion, but it is possible to run the debugger logged in as root to debug the program.

Another suggestion is to run the debugger to debug only the portions of the program which do not require root privileges, for instance using #if 0 to remove those portions while you debug other issues. That is if problems exist outside of the root required sections.

@computersavvy, or others so inclined,

While it is many times difficult to determine the intentions of many new users, and there certainly are ill-behaved posters around the web, let us not start out by accusing new members of this behavior without any basis. If you have any questions, please PM me or use the Contact Us link at the bottom of the page. Please do not continue with any off-topic discussion in this thread.

Please also remember from our forum guidelines:
Quote:
  • Personal attacks on others will not be tolerated.
  • Do not post if you do not have anything constructive to say in the post.
Quote:
Originally Posted by computersavvy View Post
Registers today and posts this kind of question? I suspect a TROLL.
A newbie would not be able to write that kind of question/background.
 
Old 03-29-2021, 12:16 PM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Yes, 'sudo -i' can be used to log in as root even when the root account is not enabled.
 
Old 03-29-2021, 05:24 PM   #6
Senitar
LQ Newbie
 
Registered: Mar 2021
Distribution: Raspberry Pi
Posts: 2

Original Poster
Rep: Reputation: Disabled
sudo -i solved my problem. Since I'm on my own RaspberryPi running as root is no issue. Although I've been a developer on windows for over 30 years, I have only been using Linux for a few days now. I guess it time to find some on-line course on linux basics.

Thanks for your help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GDB remote debug "permission denied" when trying to remotely debug program jguo5258 Linux - Software 3 12-08-2019 08:48 AM
debug library source in GDB/DDD knobby67 Programming 1 08-25-2009 02:24 PM
how debug kernel with ddd? how debug the kernel with ddd? mjalalynia Linux - Kernel 2 08-25-2008 06:50 AM
sed command to replace ddd.mm.ss.s with ddd:mm:ss.s? johnpaulodonnell Programming 4 06-08-2007 06:57 AM
Adobe Acrobate Reader Requires A Plugin-That Requires Open LDAP That Requires Berkely Old_Fogie Slackware 10 05-08-2006 05:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration