Stefan Reinauer | 0d2119d | 2013-07-10 14:27:56 -0700 | [diff] [blame] | 1 | diff -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 Vollering | fedb63a | 2012-10-25 02:06:57 +0200 | [diff] [blame] | 4 | @@ -1227,6 +1227,15 @@ |
zbao | 79b0574 | 2012-08-21 16:25:41 +0800 | [diff] [blame] | 5 | 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 | |