aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 288c701..0b7b7ba 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -647,6 +647,17 @@ Enables or disables printing of Python stack traces."),
&show_python_list);
#ifdef HAVE_PYTHON
+#ifdef WITH_PYTHON_PATH
+ /* Work around problem where python gets confused about where it is,
+ and then can't find its libraries, etc.
+ NOTE: Python assumes the following layout:
+ /foo/bin/python
+ /foo/lib/pythonX.Y/...
+ This must be done before calling Py_Initialize. */
+ Py_SetProgramName (concat (ldirname (python_libdir), SLASH_STRING, "bin",
+ SLASH_STRING, "python", NULL));
+#endif
+
Py_Initialize ();
PyEval_InitThreads ();