[RFC] Fix _gdb registration

Tom Tromey tromey@adacore.com
Fri Jun 3 16:54:48 GMT 2022


Currently, the _gdb module is only registered when WITH_PYTHON_PATH is
defined.  This seems wrong to me, though I don't know how to test it
-- does anyone build gdb without WITH_PYTHON_PATH, and can that even
work?

This patch shows the change I think should be made.  Alternatively, we
could just remove WITH_PYTHON_PATH entirely.
---
 gdb/python/python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 9bef2252e88..e3ad431671e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -2000,10 +2000,10 @@ do_start_initialization ()
      remain alive for the duration of the program's execution, so
      it is not freed after this call.  */
   Py_SetProgramName (progname_copy);
+#endif
 
   /* Define _gdb as a built-in module.  */
   PyImport_AppendInittab ("_gdb", init__gdb_module);
-#endif
 
   Py_Initialize ();
 #if PY_VERSION_HEX < 0x03090000
-- 
2.34.1



More information about the Gdb-patches mailing list