David Miller writes:
GDB exec's a shell to setup your environment properly then execute the
program to be debugged. In this way GDB's environemnt doesn't need
to be altered among other things.
This "feature" of gdb has caused me nothing but pain over the years; no
other program thinks it needs to "setup your environment properly" rather
than just use the environment as is. In almost every case where I have
trouble, the environment *was* set up properly before GDB destroyed it by
exec-ing a shell. Life tends to be worse for csh/tcsh users, but bash
users can also be messed up.
Unfortunately, gdb's developers like it this way, so the rest of us just
have to work around the damage.