Files
qt-creator/dist/gdb/patches/pythonhome-7.4.patch
David Schulz d800dadc5d Added build scripts for GDB
Change-Id: I7300952fa95337fd6f5bcdb7a88933e8c06538b1
Reviewed-by: hjk <qthjk@ovi.com>
2012-04-16 10:14:55 +02:00

39 lines
1.1 KiB
Diff

*** 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 <ctype.h>
/* Declared constants and enum for python stack printing. */
--- 32,38 ----
#include "serial.h"
#include "readline/tilde.h"
#include "python.h"
! #include <libgen.h>
#include <ctype.h>
/* 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 ();