*** source/gdb-7.4/gdb/python/python.c 2012-02-01 10:39:59.812953656 +0100 --- staging/gdb-7.4/gdb/python/python.c 2012-02-01 10:33:45.842953480 +0100 *************** *** 32,38 **** #include "serial.h" #include "readline/tilde.h" #include "python.h" ! #include /* Declared constants and enum for python stack printing. */ --- 32,38 ---- #include "serial.h" #include "readline/tilde.h" #include "python.h" ! #include #include /* Declared constants and enum for python stack printing. */ *************** *** 1273,1278 **** --- 1273,1288 ---- SLASH_STRING, "python", NULL)); #endif + + char readlinkbuffer[BUFSIZ]; + int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1); + readlinkbuffer[readlinks] = 0; + char *executeablepath = dirname(readlinkbuffer); + char *pythonhome = malloc(strlen(executeablepath) + strlen("/python/") + 2); + strcpy(pythonhome, executeablepath); + strcat(pythonhome, "/python/"); + setenv("PYTHONHOME", pythonhome, 1); + Py_Initialize (); PyEval_InitThreads ();