2c3cd125be
This allows GDB to run Python scripts. The Python build is dependant on the GDB build flag. Changes by Stefan Reinauer: - update to latest buildgcc script - disable GDB per default - disable python scripting, if GDB is not enabled - bump version number to 1.06 Change-Id: Ie7fc8706deec41c804870415d3c79d225c98cd31 Signed-off-by: Marc Jones <marcj303@gmail.com> Reviewed-on: http://review.coreboot.org/153 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
27 lines
901 B
Diff
27 lines
901 B
Diff
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 ();
|
|
|