This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]