blob: dfca5dd03a44aa62ab52931fd3726a4e8a7c16df [file] [log] [blame]
Stefan Reinauer0d2119d2013-07-10 14:27:56 -07001diff -ur gdb-7.6/gdb/python/python.c gdb-7.6.patched/gdb/python/python.c
2--- gdb-7.6/gdb/python/python.c 2012-06-25 18:53:20.000000000 +0200
3+++ gdb-7.6.patched/gdb/python/python.c 2012-10-24 15:28:37.422047.69 +0200
Idwer Volleringfedb63a2012-10-25 02:06:57 +02004@@ -1227,6 +1227,15 @@
zbao79b05742012-08-21 16:25:41 +08005 SLASH_STRING, "python", NULL));
6 #endif
7
8+ char readlinkbuffer[BUFSIZ];
9+ int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1);
10+ readlinkbuffer[readlinks] = 0;
11+ char *executeablepath = dirname(readlinkbuffer);
12+ char *pythonhome = malloc(strlen(executeablepath) + strlen("/../") + 2);
13+ strcpy(pythonhome, executeablepath);
14+ strcat(pythonhome, "/../");
15+ setenv("PYTHONHOME", pythonhome, 1);
16+
17 Py_Initialize ();
18 PyEval_InitThreads ();
19