diff --git a/gdb-fix-python37-breakage.patch b/gdb-fix-python37-breakage.patch new file mode 100644 index 0000000..74b3d19 --- /dev/null +++ b/gdb-fix-python37-breakage.patch @@ -0,0 +1,68 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Paul Koning +Date: Fri, 8 Jun 2018 13:26:36 -0400 +Subject: gdb-fix-python37-breakage.patch + +FileName: gdb-fix-python37-breakage.patch + +;; Fix build breakage with Python 3.7 +;; RHBZ #1577396 + +Fix build issue with Python 3.7 + +Originally reported in +https://bugzilla.redhat.com/show_bug.cgi?id=1577396 -- gdb build fails +with Python 3.7 due to references to a Python internal function whose +declaration changed in 3.7. + +gdb/ChangeLog +2018-06-08 Paul Koning + + PR gdb/23252 + + * python/python.c (do_start_initialization): + Avoid call to internal Python API. + (init__gdb_module): New function. + +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1810,6 +1810,17 @@ finalize_python (void *ignore) + restore_active_ext_lang (previous_active); + } + ++#ifdef IS_PY3K ++/* This is called via the PyImport_AppendInittab mechanism called ++ during initialization, to make the built-in _gdb module known to ++ Python. */ ++PyMODINIT_FUNC ++init__gdb_module (void) ++{ ++ return PyModule_Create (&python_GdbModuleDef); ++} ++#endif ++ + static bool + do_start_initialization () + { +@@ -1850,6 +1861,9 @@ 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); ++ ++ /* Define _gdb as a built-in module. */ ++ PyImport_AppendInittab ("_gdb", init__gdb_module); + #else + Py_SetProgramName (progname.release ()); + #endif +@@ -1859,9 +1873,7 @@ do_start_initialization () + PyEval_InitThreads (); + + #ifdef IS_PY3K +- gdb_module = PyModule_Create (&python_GdbModuleDef); +- /* Add _gdb module to the list of known built-in modules. */ +- _PyImport_FixupBuiltin (gdb_module, "_gdb"); ++ gdb_module = PyImport_ImportModule ("_gdb"); + #else + gdb_module = Py_InitModule ("_gdb", python_GdbMethods); + #endif diff --git a/gdb.changes b/gdb.changes index 49a4676..b1241d7 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 10 08:58:06 UTC 2018 - tchvatal@suse.com + +- Apply patch from fedora to build with python3.7: + * gdb-fix-python37-breakage.patch + ------------------------------------------------------------------- Tue Mar 27 14:01:27 UTC 2018 - matz@suse.com diff --git a/gdb.spec b/gdb.spec index 010155a..60d0aed 100644 --- a/gdb.spec +++ b/gdb.spec @@ -23,7 +23,7 @@ %bcond_without testsuite Summary: A GNU source-level debugger for C, C++, Fortran and other languages -License: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and LGPL-3.0+ +License: GPL-3.0-or-later AND GPL-3.0-with-GCC-exception AND LGPL-2.1-or-later AND LGPL-3.0-or-later Group: Development/Tools/Debuggers Name: gdb @@ -224,6 +224,7 @@ Patch123: gdb-archer.patch Patch124: gdb-vla-intel-fix-print-char-array.patch Patch125: gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch Patch126: gdb-ppc64-stwux-tautological-compare.patch +Patch127: gdb-fix-python37-breakage.patch #Fedora Packages end # Upstream patch to fix gcc -Werror @@ -352,7 +353,7 @@ and printing their data. %if %{suse_version} > 1010 %package -n gdbserver Summary: A standalone server for GDB (the GNU source-level debugger) -License: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and LGPL-3.0+ +License: GPL-3.0-or-later AND GPL-3.0-with-GCC-exception AND LGPL-2.1-or-later AND LGPL-3.0-or-later Group: Development/Tools/Debuggers %description -n gdbserver @@ -366,7 +367,7 @@ machine than the one which is running the program being debugged. %package doc Summary: Documentation for GDB (the GNU source-level debugger) -License: GFDL-1.3 +License: GFDL-1.3-only Group: Documentation/Other PreReq: %{install_info_prereq} @@ -532,6 +533,7 @@ find -name "*.info*"|xargs rm -f %patch124 -p1 %patch125 -p1 %patch126 -p1 +%patch127 -p1 #Fedora patching end %patch1002 -p1