1 diff -ur gdb-7.3.1.orig/gdb/python/python.c gdb-7.3.1/gdb/python/python.c
2 --- gdb-7.3.1.orig/gdb/python/python.c 2011-07-02 21:33:10.000000000 +0200
3 +++ gdb-7.3.1/gdb/python/python.c 2011-11-01 21:07:25.000000000 +0100
10 /* True if we should print the stack when catching a Python error,
12 @@ -1010,6 +1011,15 @@
13 SLASH_STRING, "python", NULL));
16 + char readlinkbuffer[BUFSIZ];
17 + int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1);
18 + readlinkbuffer[readlinks] = 0;
19 + char *executeablepath = dirname(readlinkbuffer);
20 + char *pythonhome = malloc(strlen(executeablepath) + strlen("/../") + 2);
21 + strcpy(pythonhome, executeablepath);
22 + strcat(pythonhome, "/../");
23 + setenv("PYTHONHOME", pythonhome, 1);
26 PyEval_InitThreads ();