The executable which gdb was launched with is extracted from a core file and then transformed into an absolute path with "which". The latter failed, as by the time it's executed, PATH has not yet been expanded. Solved by using the executable name only, which then gets searched in the PATH by gdb.