LinuxQuestions.org
Help answer threads with 0 replies.
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 02-24-2013, 09:36 AM   #16
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285

Assigning execution permission to file(s) was necessory, else they cannot be executed. Besides, did you check your gbd command or it's help section or manual?
Code:
$ man gdb
According to an online manual (see here):
Code:
~$ gdb name-of-executable
~$ gdb -e name-of-executable -c name-of-core-file
~$ gdb name-of-executable -pid process-id
So run it as:
Code:
~$ gdb /home/jharvard/src2w/factorial 
OR
~$ gdb -e /home/jharvard/src2w/factorial
OR
~$ gdb -e /home/jharvard/src2w/factorial  -c /home/jharvard/src2w/factorial.c
 
Old 02-24-2013, 09:46 AM   #17
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by atlantis43 View Post
Don't understand why I have to run gdb in this fashion (as compared to what was given in the course's online instructions)
If those online instructions told you to put the filename as an argument to the r command, I'm pretty sure those instructions are simply wrong.

Quote:
Only remaining question is whether I will have to use that format for engageing gdb for each program I might want to debug?
You need to use some correct method to tell gdb which executable you are debugging. The usual method is to give the name of that executable as an argument to the command that starts gdb. Using the file command inside gdb is a less common method. Use whichever you prefer.

Quote:
Originally Posted by shivaa View Post
Assigning execution permission to file(s) was necessory, else they cannot be executed.
We can see in post #11 that the permissions were already OK, apparently before atlantis43 understood and tried the instructions to fix the permissions (post #14).

Most methods of building or obtaining an executable will get correct permissions automatically. There are some situations in which a chmod command, such as you suggested, will be needed. But I don't see indication of that need in what has been posted in this thread.

Quote:
Originally Posted by shivaa View Post
According to an online manual (see here):
A cheat sheet, like that, is a big help for someone like me, who understands all the concepts but forgets all the syntax details.

But gdb is too complicated to really use from just a cheat sheet. So far as I understand, the best gdb information is in the info form of the gdb documentation. But (in my opinion) info is such a user vicious UI that it makes all of its contents useless. Fortunately, there are ways to look at info content without using info.

One of those ways (which I linked in post #13) started with using google to find a place where the desired info content had been translated to html and posted publicly. (I know I could get the translation tool and translate it for myself, but using google to find that already done is easier).

That cheat sheet you linked did include (not very obviously) a link to the really complete gdb documentation
http://sourceware.org/gdb/current/onlinedocs/gdb/
But for most people that is too much information. The parts you need are too hard to dig out from the obscure information that experts occasionally need.

The man page or cheat sheet level of documentation is too little to be useful for gdb. The full documentation is too much, so I recommend the in between level of info, but only when converted for a usable UI.

Last edited by johnsfine; 02-24-2013 at 10:06 AM.
 
1 members found this post helpful.
Old 02-24-2013, 09:55 AM   #18
atlantis43
Member
 
Registered: Feb 2013
Posts: 228

Original Poster
Rep: Reputation: Disabled
Thanks to all for your great attention to my problem, and patience toward my ignorance.
Problem now appears to be solved.
 
Old 02-24-2013, 10:13 AM   #19
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
@johnsfine:
Thanks for more clarification.

@atlantis43:
You can mark the thread as solved, if you think it has so.
 
Old 02-24-2013, 10:27 PM   #20
atlantis43
Member
 
Registered: Feb 2013
Posts: 228

Original Poster
Rep: Reputation: Disabled
newbie problem

Quote:
Originally Posted by linosaurusroot View Post
(gdb) file ./strings
(gdb) r
Thanks so much for this succinct solution to my problem. Too bad I didn't understand that you simply meant to enter these as sequential commands. It would have saved me (and several other sysops) much time had I only been more conversant with what you meant.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] cant make a file executable by terminal typing "chmod +x layerfx.py" froylan Ubuntu 3 07-26-2012 03:41 PM
gdb says "cannot open shared object file" mihk Programming 1 05-31-2009 02:10 PM
gdb giving "Not executable format" error with .so paulc4 Programming 4 04-06-2009 08:32 AM
gdb "not in executable format: File format not recognized" tcma Programming 9 07-18-2007 07:02 AM
gdb error "Failed to read a valid object file image from memory." Fejimush Programming 0 03-11-2007 02:40 PM


All times are GMT -5. The time now is 03:01 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration