This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] 64-bit python support
- From: Ruben Van Boxem <vanboxem dot ruben at gmail dot com>
- To: gdb-patches at sourceware dot org, mingw64 <mingw-w64-public at lists dot sourceforge dot net>
- Date: Tue, 10 May 2011 14:57:09 +0200
- Subject: [PATCH] 64-bit python support
- Reply-to: vanboxem dot ruben at gmail dot com
Hi,
Attached is a patch that tells gdb-python to use the Py_InitModule4_64
function instead of Py_InitModule for 64-bit builds.
The latter is not in the official Python x64 Windows dll, and from
looking around on the net, neither is it present on 64-bit linux
Python libraries (can't say that for sure though). This patch allows a
successful build with mingw-w64.
Here is a link to the rationale for the different function name on the
Python website:
http://www.python.org/dev/peps/pep-0353/#specification
The patch was made using the 7.3 branch. Please comment on and/or OK
this patch. Thanks!
Ruben
diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c
index 50c05f3..3a541b4 100644
--- a/gdb/python/py-evts.c
+++ b/gdb/python/py-evts.c
@@ -44,8 +44,11 @@ add_new_registry (eventregistry_object **registryp, char *name)
void
gdbpy_initialize_py_events (void)
{
+#if defined(__x86_64__)
+ gdb_py_events.module = Py_InitModule4_64 ("events", NULL);
+#else
gdb_py_events.module = Py_InitModule ("events", NULL);
-
+#endif
if (!gdb_py_events.module)
goto fail;
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 90d5dc8..3323433 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1013,7 +1013,11 @@ Enables or disables printing of Python stack traces."),
Py_Initialize ();
PyEval_InitThreads ();
+#if defined(__x86_64__)
+ gdb_module = Py_InitModule4_64 ("gdb", GdbMethods);
+#else
gdb_module = Py_InitModule ("gdb", GdbMethods);
+#endif
/* The casts to (char*) are for python 2.4. */
PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version);