GDB exec error: no such file or directory

I have an executable from which I can read characters (so it seems). My problem is this: when it's time to start, I get the following error:

(gdb) run Starting program: /home/usr/src/etcetera/etcetera/bin/theExecutable.exe Cannot exec -c exec /home/usr/src/etcetera/etcetera/bin/theExecutable.exe. Error: No such file or directory During startup program exited with code 127

obviously i edited directories here. I searched for how to fix this on SO, and tried some of the following solutions:

gdb cannot see the source file

GDB cannot find source file

gdb can't load source file?

got from this link:

https://sourceware.org/gdb/download/onlinedocs/gdb/Source-Path.html#Source-Path

and trying to change the directory of the source file. (The source files are not in the same location as the executable, but are instead distributed to different locations.) If I'm not mistaken, the way to do it is:

(gdb) directory /home/usr/src/etcetera/etcetera/rootDirectoryForSourcefiles

and find GDB in that directory. I even tried changing directory to original directory and then starting, but still, it wants to try where the executable is running.

Am I completely oblivious to the obvious path here, or might it be rather obscure?

Note , if you want to downgrade this question, I would like to get an explanation why, so I can improve the future

thank

+3


source to share


2 answers


You are barking the wrong tree. You have a problem ~ not related to source files, and everything related to your executable.

It might have to do with something in yours ~/.gdbinit

or yours, ~/.bashrc

or with the way you called GDB.

You should start with a basic sanity check:



env SHELL=/bin/sh gdb -nx /bin/date
(gdb) run

      

If that doesn't work, your GDB installation is screwing.

If this works, one of the three things I mentioned above is most likely the cause of your problems.

+1


source


I had this problem and it turned out that the shell was not installed correctly in the file /etc/passwd

.

To solve this problem, I opened the file with



sudo vipw

      

and added /bin/bash

to my account details.

0


source







All Articles