Reputation: 483
I'm receiving this gdb error on any code I try to debug any program with gdb. Here's the simplest process that reproduces the error
main.cpp
file with this content:int main(){
return 0;
}
g++ -g main.cpp
gdb a.out
break 2
run
Output:
Starting program: /tmp/test/a.out
During startup program exited normally.
This is all done with gdb on the command line. I've tried using g++ and gcc with the same result. I'm not really sure where to go from here.
EDIT: I figured out what is causing the issue, but not how to fix it. The issue seems to be something related to my SHELL
variable. I'm currently using xonsh as my shell but when I set my SHELL
environment variable back to /bin/bash
everything works as expected. Is there anything I can do to fix this while using xonsh? Should I report this to xonsh, gdb, both or neither?
Upvotes: 3
Views: 802
Reputation: 213877
I'm currently using xonsh as my shell but when I set my SHELL environment variable back to /bin/bash everything works as expected. Is there anything I can do to fix this while using xonsh? Should I report this to xonsh, gdb, both or neither?
This might be your xonsh
startup problem, or it might be xonsh
problem, or it could be that xonsh
doesn't do what GDB expects it to do.
Normally, GDB fork
s / exec
s $SHELL -c "/path/to/your/exe $args"
and expects the $SHELL
to exec
your program (this is done so shell redirection still works under GDB).
Only after that exec
will GDB start setting breakpoints, etc.
If you have some xonsh
init-file, which e.g. causes xonsh
to exec
something else, things could go bad. So I suggest trying to remove any such ~/.xonshrc
or whatever it's called file, and seeing whether that fixes the problem.
If it doesn't, it could be that xonsh
e.g. fork
s and exec
s your binary in a child (grandchild of GDB) instead of doing it directly, or it could be that xonsh
doesn't understand the -c ...
syntax.
If you don't care about redirection, you could also ask GDB to not use $SHELL
at all: set startup-with-shell off
. Documentation.
Upvotes: 4