This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Using Py_SetPythonHome
- From: Meador Inge <meadori at codesourcery dot com>
- To: <gdb at sourceware dot org>
- Cc: <brobecker at adacore dot com>
- Date: Wed, 12 Sep 2012 18:22:45 -0500
- Subject: Using Py_SetPythonHome
Hi All,
I noticed in Nov 2010 Joel proposed adding a call to Py_SetPythonHome in this
thread [1]. However, it seems that got dropped. I would like to bring this
topic up again.
The use case I am having trouble with is the one where gdb gets shipped with:
(1) its own pythonxy.so, (2) a zipped standard library, and (3) a directory for
the standard library module shared libraries. In this case, Py_SetPythonHome
needs to be called before Py_Initialize so that the standard library pieces can
even be found (Py_Initialize does some imports).
So, I was playing around with something like what Joel proposed, but before
Py_Initiliaze:
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 482f53e..fa86e61 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1353,6 +1353,7 @@ message == an error message without a stack will be printe
This must be done before calling Py_Initialize. */
Py_SetProgramName (concat (ldirname (python_libdir), SLASH_STRING, "bin",
SLASH_STRING, "python", NULL));
+ Py_SetPythonHome (ldirname (python_libdir));
#endif
Py_Initialize ();
Is there another way around the problem I am having? Have the feelings
concerning Py_SetPythonHome changed since comments in [1] ?
[1] http://sources.redhat.com/ml/gdb-patches/2010-11/msg00328.html
--
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software