LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   gdb giving wierd error (https://www.linuxquestions.org/questions/linux-software-2/gdb-giving-wierd-error-169299/)

BradDaBug 04-12-2004 04:49 PM

gdb giving wierd error
 
I was checking a program I'm working on with valgrind for memory leaks and apparently it found an invalid memory access and threw a segfault. It wouldn't tell me where it happened (well, it did, but I need more info) so I decided to check it out with gdb. Except now whenever I run gdb and try to "run" the program, I get this error:

Starting program: *name of program*
Cannot exec : No such file or directory.

Program exited with code 0177.
You can't do that without a process to debug.

I can check ANY program with gdb and it gives this same error. When I try to use Anjuta to debug the program it gives similar error messages.

Anyone have any idea what's wrong?

Edit: It works when I login as root, but not as a regular user.

Beaven 05-06-2004 05:31 AM

I had a similar problem a while back. gdb is not finding your shell. You need to set the env var SHELL to whatever you're wanting to use. eg. /bin/csh

sonitbk 09-14-2004 06:12 PM

thanks for help...I had similar thing..and this helps..thanks again.

dombrowsky 03-20-2012 08:19 AM

Just a post to give props to the answerer. I was working in a chroot environment, which had inherited my SHELL variable as /bin/bash. Since I was in busybox, it only had /bin/sh. Once I fixed that, gdb works fine again. Nice work.

Original error:
Code:

(gdb) exec-file a.out
(gdb) r
Starting program: /a.out
Cannot exec /a.out -c exec /a.out .
Error: No such file or directory
During startup program exited with code 127.

fix:
Code:

# export SHELL=/bin/sh


All times are GMT -5. The time now is 06:45 AM.