diff options
Diffstat (limited to 'util/crossgcc/patches/gdb-7.3.1_pythonhome.patch')
-rw-r--r-- | util/crossgcc/patches/gdb-7.3.1_pythonhome.patch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util/crossgcc/patches/gdb-7.3.1_pythonhome.patch b/util/crossgcc/patches/gdb-7.3.1_pythonhome.patch new file mode 100644 index 0000000000..90da2d9d6f --- /dev/null +++ b/util/crossgcc/patches/gdb-7.3.1_pythonhome.patch @@ -0,0 +1,27 @@ +diff -ur gdb-7.3.1.orig/gdb/python/python.c gdb-7.3.1/gdb/python/python.c +--- gdb-7.3.1.orig/gdb/python/python.c 2011-07-02 21:33:10.000000000 +0200 ++++ gdb-7.3.1/gdb/python/python.c 2011-11-01 21:07:25.000000000 +0100 +@@ -33,6 +33,7 @@ + #include "python.h" + + #include <ctype.h> ++#include <libgen.h> + + /* True if we should print the stack when catching a Python error, + false otherwise. */ +@@ -1010,6 +1011,15 @@ + 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("/../") + 2); ++ strcpy(pythonhome, executeablepath); ++ strcat(pythonhome, "/../"); ++ setenv("PYTHONHOME", pythonhome, 1); ++ + Py_Initialize (); + PyEval_InitThreads (); + |