Wednesday, November 9, 2011

gdb uses your SHELL environment variable!

As I started using a new Ubuntu installation on a 12-core Intel machine, I realized gdb was acting strange. It reads the executable file just fine, but had trouble running the executable - when I said run and hit the return key, it took me back to the command prompt! The executable didn't seem to run at all, although ps command showed it was actually running.


With some help from a friend I decided to change the SHELL environment variable to show the current shell under which gdb was running  - /bin/bash. Voila! gdb started working as expected.

I wondered what was going on and did some online research. According to this resource here:
"Your SHELL environment variable (if it exists) specifies what shell GDB uses. If you do not define SHELL, GDB uses /bin/sh."

That means, when you run the program under gdb, gdb starts executing it under the shell specified by SHELL environment variable; and if it's not the current shell, then it will execute the program in the background.

1 comment:

  1. Casino site - choegocasino.com
    Casino site - 카지노 www.choegocasino.com. The best way to find and play online 온카지노 casino games with no download or registration 샌즈카지노 required!

    ReplyDelete