When running gdb with PYTHONHOME set to a custom python environment, gdb seems to use that python but can't find the correct environment. The result, as typical when python can't find its environment, is for python to fail on trying to import the site module, giving the following error: ImportError: No module named site This appears to apply to all versions of gdb with python support. The workaround is to run gdb with PYTHONHOME forced to the system python, such as `$ PYTHONHOME=/usr gdb`. This isn't really good enough for us though, as having non-system PYTHONHOME set is standard in our user build environments. My guess at the fix is for gdb to ignore PYTHONHOME (and probably PYTHONPATH), and always use the python it was built against. The python command line provides a -E option to do exactly that, or you can unsetenv on PYTHONHOME within gdb.
gdb actually has an equivalent configuration to python -E, if you start it with: gdb -eiex "set python ignore-environment on"