gdb "no Executable File"
Currently taking an online course which provides VMWare Player with gdb. I'm using WinXP pro, Intel on a pc.
"strings" is a binary file, and my terminal is in the appropriate directory Whenever I attempt debug with cmd '(gdb) r ./filename I get the following: (gdb) r ./strings Starting program: ./strings No executable file specified. Use the "file" or "exec-file" command. Could someone explain what might be wrong to cause the above, and what I might do to correct it. Also, how does one "use the 'file' or 'exec-file' command, if this will help solve the problem. What might be addn'l info regarding this problem, the "make" cmd in my compiler runs: "clang -ggdb3 -O0 -std=c99 -Wall -Werror" with some additional remarks. Hope that someone can help make this functional. |
Is there execution permission for strings file?
Code:
[user@example]~$ ls -la /path/to/strings Code:
[user@example]~$ chmod +x /path/to/strings |
(gdb) file ./strings
(gdb) r |
Shiva cmds give following response on my terminal:
jharvard@appliance (~/src2w): [user@example]~$ ls -la /path/to/strings bash: [user@example]~$: command not found jharvard@appliance (~/src2w): [user@example]~$ chmod +x /path/to/strings bash: [user@example]~$: command not found >>>>>>>>>>>>>> I don't really know what you mean by execution permission, but I can successfully write and run the code on the terminal. L Root suggestions give the following terminal screen: >>>>>>>>>>> (gdb) ./strings: No such file or directory. Undefined command: "". Try "help". (gdb) (gdb) r Undefined command: "". Try "help". (gdb) Starting program: Undefined command: "Starting". Try "help". (gdb) No executable file specified. (gdb) Use the "file" or "exec-file" command. |
shivaa's example was just showing you the standard linux command prompt, you weren't supposed to actually run the "[user@example]~$" part. He even put it in green to separate it from the actual command. Many of the replies you receive on Linux forums will give some kind of command prompt in the replies. This separates the command you're supposed to run from the expected output from that command. For example, if I were to write:
Code:
date Code:
$ date Code:
[user@example]~$ date You need to run the command itself, "ls -la /path/to/strings" and "chmod +x /path/to/strings". Ignore the "[user@example]~$" since that's just an example command prompt. |
Quote:
Code:
ls -la /usr/bin/strings |
@atlantis43:
Wait.. Wait... as suicidaleggroll mentioned, [user@example]~$: is NOT part of the original command(s). Its just prompt which I used in my example for clarity. And /path/to/strings means full path of the strings file, like /home/foo/bar/strings. Anyway, you simply need to run following commands: Code:
ls -la ./strings Quote:
|
Quote:
While I've never seen a malcontent post on LinuxQuestions, blindly executing any command posted by a stranger, without understanding what you're running or why, is never a good thing. While we're on the subject, it's about time to familiarize yourself with the "man" command. Man stands for "manual", and when run with the name of a command you're curious about, it will give you the manual of that command so you can see what it does, what the various switches are and what they do, etc. For example, take the Code:
$ ls -la ./strings Code:
$ man ls Code:
NAME Code:
-l use a long listing format Code:
-a do not ignore entries starting with . Code:
$ ls -la |
thanks to all for clarifications. none of the suggestions given seem to help, though perhaps I don't fully understand them. [I am correctly listed as a novice :-)]
I know that there is program 'strings.c' (compiled) and 'strings' (binary), both present in file ~/src2w/filename. -ls shows both files present where they're supposed to be. Still doesn't explain why gdb can't execute them. |
Can you post output of:
Code:
ls -la ~/src2w/filename/*strings* |
Shivaa;
running your suggestions on code named "factorial", I get following results: >>>>>>>>>>>>>>> jharvard@appliance (~): ls -la ~/src2w/*factorial* -rwx------. 1 jharvard students 10642 Feb 22 10:56 /home/jharvard/src2w/factorial -rw-r--r--. 1 jharvard students 332 Feb 22 09:05 /home/jharvard/src2w/factorial.c >>>>>>>>>>>>>>>>> (what are those asterisks for, anyway) then, when gdb run on this file: >>>>>>>>>>>> (gdb) r ./factorial Starting program: ./factorial No executable file specified. Use the "file" or "exec-file" command. >>>>>>>>>>>>>> I've gotten this result previously, have looked in the man for file cmd, etc, but don't have the understanding of what the info means. In addition, now having looked at the manual with a little better understanding, I get the following info about the file: >>>>>>>>>> jharvard@appliance (~/src2w): file factorial factorial: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, not stripped Hope this helps further in determining what my problem is. |
Once invoke these two commands:
Code:
chmod a+x /home/jharvard/src2w/factorial Code:
(gdb) r ./factorial |
The OP is apparently not giving correct commands to gdb. That fact has been buried in this thread by all the focus on checking whether the executable file is valid. There is no reason to believe anything is wrong with the file.
I think this early reply was correct but ignored http://www.linuxquestions.org/questi...8/#post4898436 Here is a link to the relevant part of the gdb documentation: http://uw714doc.sco.com/cgi-bin/info...arting&lang=en You can specify the executable to be debugged on the command line that starts gdb, or you can specify it with a file command inside gdb. But you cannot specify it as a parameter to the r command in gdb. |
OK, so I did the following (with no evident results, though I didn't know what to expect)
jharvard@appliance (~): chmod a+x /home/jharvard/src2w/factorial jharvard@appliance (~): chmod a+x /home/jharvard/src2w/factorial.c and then did: (gdb) No executable file specified. (gdb) Use the "file" or "exec-file" command. Undefined command: "Use". Try "help". Not looking promising! |
Johnsfine attention to detail indeed worked. lroot's 2-liner was the answer, and I now have GDB working.
Don't understand why I have to run gdb in this fashion (as compared to what was given in the course's online instructions), but perhaps the link to the gdb documentation will answer that. Only remaining question is whether I will have to use that format for engageing gdb for each program I might want to debug? |
All times are GMT -5. The time now is 12:06 PM. |