Projects
openEuler:Mainline
gdb
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
_service:tar_scm:gdb.spec
Changed
@@ -1,6 +1,6 @@ Name: gdb Version: 12.1 -Release: 3 +Release: 6 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL-1.3 Source: https://ftp.gnu.org/gnu/gdb/gdb-%{version}.tar.xz @@ -88,6 +88,12 @@ Patch77: 0001-set-entry-point-when-text-segment-is-missing.patch Patch78: 0002-Add-support-for-readline-8.2.patch +Patch79: gdb-initialize-the-data_head-variable-to-eliminate-c.patch +Patch80: gdb-python-remove-Python-2-support.patch +Patch81: gdb-Use-bool-for-evregpy_no_listeners_p.patch +Patch82: gdb-Make-import-gdb.events-work.patch +Patch83: gdb-Handle-Python-3.11-deprecation-of-PySys_SetPath-and-.patch +Patch84: gdb-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch %global gdb_src gdb-%{version} %global gdb_build build-%{_target_platform} @@ -363,6 +369,15 @@ %{_infodir}/ctf-spec.info.gz %changelog +* Thu Aug 3 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.1-6 +- libctf: update regexp to allow makeinfo to build document + +* Thu Jul 27 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.1-5 +- Handle Python 3.11 deprecation of PySys_SetPath and Py_SetProgramName + +* Thu Jul 27 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.1-4 +- initialize the data_head variable to eliminate compilation warnings + * Tue Feb 14 2023 Wenyu Liu <liuwenyu7@huawei.com> - 12.1-3 - Rectify the spec file.
View file
_service:tar_scm:gdb-Handle-Python-3.11-deprecation-of-PySys_SetPath-and-.patch
Added
@@ -0,0 +1,256 @@ +From eb6d8345fb21aa4eba9b02289645f3265c02175b Mon Sep 17 00:00:00 2001 +From: Kevin Buettner <kevinb@redhat.com> +Date: Thu, 30 Jun 2022 15:40:29 -0700 +Subject: PATCH Handle Python 3.11 deprecation of PySys_SetPath and + Py_SetProgramName + +Python 3.11 deprecates PySys_SetPath and Py_SetProgramName. The +PyConfig API replaces these and other functions. This commit uses the +PyConfig API to provide equivalent functionality while also preserving +support for older versions of Python, i.e. those before Python 3.8. + +A beta version of Python 3.11 is available in Fedora Rawhide. Both +Fedora 35 and Fedora 36 use Python 3.10, while Fedora 34 still used +Python 3.9. I've tested these changes on Fedora 34, Fedora 36, and +rawhide, though complete testing was not possible on rawhide due to +a kernel bug. That being the case, I decided to enable the newer +PyConfig API by testing PY_VERSION_HEX against 0x030a0000. This +corresponds to Python 3.10. + +We could try to use the PyConfig API for Python versions as early as 3.8, +but I'm reluctant to do this as there may have been PyConfig related +bugs in earlier versions which have since been fixed. Recent linux +distributions should have support for Python 3.10. This should be +more than adequate for testing the new Python initialization code in +GDB. + +Information about the PyConfig API as well as the motivation behind +deprecating the old interface can be found at these links: + +https://github.com/python/cpython/issues/88279 +https://peps.python.org/pep-0587/ +https://docs.python.org/3.11/c-api/init_config.html + +The v2 commit also addresses several problems that Simon found in +the v1 version. + +In v1, I had used Py_DontWriteBytecodeFlag in the new initialization +code, but Simon pointed out that this global configuration variable +will be deprecated in Python 3.12. This version of the patch no longer +uses Py_DontWriteBytecodeFlag in the new initialization code. +Additionally, both Py_DontWriteBytecodeFlag and Py_IgnoreEnvironmentFlag +will no longer be used when building GDB against Python 3.10 or higher. +While it's true that both of these global configuration variables are +deprecated in Python 3.12, it makes sense to disable their use for +gdb builds against 3.10 and higher since those are the versions for +which the PyConfig API is now being used by GDB. (The PyConfig API +includes different mechanisms for making the same settings afforded +by use of the soon-to-be deprecated global configuration variables.) + +Simon also noted that PyConfig_Clear() would not have be called for +one of the failure paths. I've fixed that problem and also made the +rest of the "bail out" code more direct. In particular, +PyConfig_Clear() will always be called, both for success and failure. + +The v3 patch addresses some rebase conflicts related to module +initialization . Commit 3acd9a692dd ("Make 'import gdb.events' work") +uses PyImport_ExtendInittab instead of PyImport_AppendInittab. That +commit also initializes a struct for each module to import. Both the +initialization and the call to were moved ahead of the ifdefs to avoid +having to replicate (at least some of) the code three times in various +portions of the ifdefs. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28668 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29287 +--- + gdb/python/python-internal.h | 5 ++ + gdb/python/python.c | 99 +++++++++++++++++++++++++++++------- + 2 files changed, 86 insertions(+), 18 deletions(-) + +diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h +index 84f45ca..70808c9 100644 +--- a/gdb/python/python-internal.h ++++ b/gdb/python/python-internal.h +@@ -199,6 +199,10 @@ gdb_PySys_GetObject (const char *name) + + #define PySys_GetObject gdb_PySys_GetObject + ++/* PySys_SetPath was deprecated in Python 3.11. Disable the deprecated ++ code for Python 3.10 and newer. */ ++#if PY_VERSION_HEX < 0x030a0000 ++ + /* PySys_SetPath's 'path' parameter was missing the 'const' qualifier + before Python 3.6. Hence, we wrap it in a function to avoid errors + when compiled with -Werror. */ +@@ -212,6 +216,7 @@ gdb_PySys_SetPath (const GDB_PYSYS_SETPATH_CHAR *path) + } + + #define PySys_SetPath gdb_PySys_SetPath ++#endif + + /* Wrap PyGetSetDef to allow convenient construction with string + literals. Unfortunately, PyGetSetDef's 'name' and 'doc' members +diff --git a/gdb/python/python.c b/gdb/python/python.c +index e3f2550..97f421d 100644 +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1709,8 +1709,14 @@ set_python_ignore_environment (const char *args, int from_tty, + struct cmd_list_element *c) + { + #ifdef HAVE_PYTHON ++ /* Py_IgnoreEnvironmentFlag is deprecated in Python 3.12. Disable ++ its usage in Python 3.10 and above since the PyConfig mechanism ++ is now (also) used in 3.10 and higher. See do_start_initialization() ++ in this file. */ ++#if PY_VERSION_HEX < 0x030a0000 + Py_IgnoreEnvironmentFlag = python_ignore_environment ? 1 : 0; + #endif ++#endif + } + + /* When this is turned on before Python is initialised then Python will +@@ -1738,6 +1744,24 @@ show_python_dont_write_bytecode (struct ui_file *file, int from_tty, + value); + } + ++/* Return value to assign to PyConfig.write_bytecode or, when ++ negated (via !), Py_DontWriteBytecodeFlag. Py_DontWriteBytecodeFlag ++ is deprecated in Python 3.12. */ ++ ++static int ++python_write_bytecode () ++{ ++ int wbc = 0; ++ ++ if (python_dont_write_bytecode == AUTO_BOOLEAN_AUTO) ++ wbc = (!python_ignore_environment ++ && getenv ("PYTHONDONTWRITEBYTECODE") != nullptr) ? 0 : 1; ++ else ++ wbc = python_dont_write_bytecode == AUTO_BOOLEAN_TRUE ? 0 : 1; ++ ++ return wbc; ++} ++ + /* Implement 'set python dont-write-bytecode'. This sets Python's internal + flag no matter when the command is issued, however, if this is used + after Py_Initialize has been called then many modules could already +@@ -1748,13 +1772,13 @@ set_python_dont_write_bytecode (const char *args, int from_tty, + struct cmd_list_element *c) + { + #ifdef HAVE_PYTHON +- if (python_dont_write_bytecode == AUTO_BOOLEAN_AUTO) +- Py_DontWriteBytecodeFlag +- = (!python_ignore_environment +- && getenv ("PYTHONDONTWRITEBYTECODE") != nullptr) ? 1 : 0; +- else +- Py_DontWriteBytecodeFlag +- = python_dont_write_bytecode == AUTO_BOOLEAN_TRUE ? 1 : 0; ++ /* Py_DontWriteBytecodeFlag is deprecated in Python 3.12. Disable ++ its usage in Python 3.10 and above since the PyConfig mechanism ++ is now (also) used in 3.10 and higher. See do_start_initialization() ++ in this file. */ ++#if PY_VERSION_HEX < 0x030a0000 ++ Py_DontWriteBytecodeFlag = !python_write_bytecode (); ++#endif + #endif /* HAVE_PYTHON */ + } + +@@ -1856,6 +1880,18 @@ gdbpy_gdb_exiting (int exit_code) + static bool + do_start_initialization () + { ++ /* Define all internal modules. These are all imported (and thus ++ created) during initialization. */ ++ struct _inittab mods = ++ { ++ { "_gdb", init__gdb_module }, ++ { "_gdbevents", gdbpy_events_mod_func }, ++ { nullptr, nullptr } ++ }; ++ ++ if (PyImport_ExtendInittab (mods) < 0) ++ return false; ++ + #ifdef WITH_PYTHON_PATH + /* Work around problem where python gets confused about where it is, + and then can't find its libraries, etc. +@@ -1887,25 +1923,41 @@ do_start_initialization () + } + setlocale (LC_ALL, oldloc.c_str ()); + ++ /* Py_SetProgramName was deprecated in Python 3.11. Use PyConfig ++ mechanisms for Python 3.10 and newer. */ ++#if PY_VERSION_HEX < 0x030a0000 + /* Note that Py_SetProgramName expects the string it is passed to + remain alive for the duration of the program's execution, so + it is not freed after this call. */ + Py_SetProgramName (progname_copy); +-#endif ++ Py_Initialize (); ++#else ++ PyConfig config; + +- /* Define all internal modules. These are all imported (and thus +- created) during initialization. */ +- struct _inittab mods3 = +- { +- { "_gdb", init__gdb_module }, +- { "_gdbevents", gdbpy_events_mod_func }, +- { nullptr, nullptr }
View file
_service:tar_scm:gdb-Make-import-gdb.events-work.patch
Added
@@ -0,0 +1,192 @@ +From 139266420fbff31e3309235ac8e1836d19a065c7 Mon Sep 17 00:00:00 2001 +From: Tom Tromey <tromey@adacore.com> +Date: Fri, 3 Jun 2022 07:59:49 -0600 +Subject: PATCH Make 'import gdb.events' work + +Pierre-Marie noticed that, while gdb.events is a Python module, it +can't be imported. This patch changes how this module is created, so +that it can be imported, while also ensuring that the module is always +visible, just as it was in the past. + +This new approach required one non-obvious change -- when running +gdb.base/warning.exp, where --data-directory is intentionally not +found, the event registries can now be nullptr. Consequently, this +patch probably also requires + + https://sourceware.org/pipermail/gdb-patches/2022-June/189796.html + +Note that this patch obsoletes + + https://sourceware.org/pipermail/gdb-patches/2022-June/189797.html +--- + gdb/python/lib/gdb/__init__.py | 5 +++++ + gdb/python/py-evtregistry.c | 4 +++- + gdb/python/py-evts.c | 28 ++++++++++++-------------- + gdb/python/python-internal.h | 4 ++-- + gdb/python/python.c | 16 +++++++++++---- + gdb/testsuite/gdb.python/py-events.exp | 2 ++ + 6 files changed, 37 insertions(+), 22 deletions(-) + +diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py +index a52f6b4..17ee6a1 100644 +--- a/gdb/python/lib/gdb/__init__.py ++++ b/gdb/python/lib/gdb/__init__.py +@@ -27,6 +27,11 @@ else: + + from _gdb import * + ++# Historically, gdb.events was always available, so ensure it's ++# still available without an explicit import. ++import _gdbevents as events ++sys.modules'gdb.events' = events ++ + + class _GdbFile(object): + # These two are needed in Python 3 +diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c +index ef96c48..f3a7f0c 100644 +--- a/gdb/python/py-evtregistry.c ++++ b/gdb/python/py-evtregistry.c +@@ -118,7 +118,9 @@ gdbpy_initialize_eventregistry (void) + bool + evregpy_no_listeners_p (eventregistry_object *registry) + { +- return PyList_Size (registry->callbacks) == 0; ++ /* REGISTRY can be nullptr if gdb failed to find the data directory ++ at startup. */ ++ return registry == nullptr || PyList_Size (registry->callbacks) == 0; + } + + static PyMethodDef eventregistry_object_methods = +diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c +index 23a5d75..ca9326a 100644 +--- a/gdb/python/py-evts.c ++++ b/gdb/python/py-evts.c +@@ -23,7 +23,7 @@ + static struct PyModuleDef EventModuleDef = + { + PyModuleDef_HEAD_INIT, +- "gdb.events", ++ "_gdbevents", + NULL, + -1, + NULL, +@@ -33,7 +33,8 @@ static struct PyModuleDef EventModuleDef = + NULL + }; + +-/* Initialize python events. */ ++/* Helper function to add a single event registry to the events ++ module. */ + + static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION + add_new_registry (eventregistry_object **registryp, const char *name) +@@ -48,24 +49,21 @@ add_new_registry (eventregistry_object **registryp, const char *name) + (PyObject *)(*registryp)); + } + +-int +-gdbpy_initialize_py_events (void) ++/* Create and populate the _gdbevents module. Note that this is ++ always created, see the base gdb __init__.py. */ ++ ++PyMODINIT_FUNC ++gdbpy_events_mod_func () + { + gdb_py_events.module = PyModule_Create (&EventModuleDef); ++ if (gdb_py_events.module == nullptr) ++ return nullptr; + +- if (!gdb_py_events.module) +- return -1; +- +-#define GDB_PY_DEFINE_EVENT(name) \ ++#define GDB_PY_DEFINE_EVENT(name) \ + if (add_new_registry (&gdb_py_events.name, #name) < 0) \ +- return -1; ++ return nullptr; + #include "py-all-events.def" + #undef GDB_PY_DEFINE_EVENT + +- if (gdb_pymodule_addobject (gdb_module, +- "events", +- (PyObject *) gdb_py_events.module) < 0) +- return -1; +- +- return 0; ++ return gdb_py_events.module; + } +diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h +index e3a3fc4..84f45ca 100644 +--- a/gdb/python/python-internal.h ++++ b/gdb/python/python-internal.h +@@ -536,8 +536,6 @@ int gdbpy_initialize_eventregistry (void) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; + int gdbpy_initialize_event (void) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; +-int gdbpy_initialize_py_events (void) +- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; + int gdbpy_initialize_arch (void) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; + int gdbpy_initialize_registers () +@@ -556,6 +554,8 @@ int gdbpy_initialize_micommands (void) + CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION; + void gdbpy_finalize_micommands (); + ++PyMODINIT_FUNC gdbpy_events_mod_func (); ++ + /* A wrapper for PyErr_Fetch that handles reference counting for the + caller. */ + class gdbpy_err_fetch +diff --git a/gdb/python/python.c b/gdb/python/python.c +index e97bca7..e3f2550 100644 +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1891,11 +1891,20 @@ 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); + #endif + ++ /* Define all internal modules. These are all imported (and thus ++ created) during initialization. */ ++ struct _inittab mods3 = ++ { ++ { "_gdb", init__gdb_module }, ++ { "_gdbevents", gdbpy_events_mod_func }, ++ { nullptr, nullptr } ++ }; ++ ++ if (PyImport_ExtendInittab (mods) < 0) ++ return false; ++ + Py_Initialize (); + #if PY_VERSION_HEX < 0x03090000 + /* PyEval_InitThreads became deprecated in Python 3.9 and will +@@ -1962,7 +1971,6 @@ do_start_initialization () + || gdbpy_initialize_thread () < 0 + || gdbpy_initialize_inferior () < 0 + || gdbpy_initialize_eventregistry () < 0 +- || gdbpy_initialize_py_events () < 0 + || gdbpy_initialize_event () < 0 + || gdbpy_initialize_arch () < 0 + || gdbpy_initialize_registers () < 0 +diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp +index 2fdd216..4feeb02 100644 +--- a/gdb/testsuite/gdb.python/py-events.exp ++++ b/gdb/testsuite/gdb.python/py-events.exp +@@ -42,6 +42,8 @@ clean_restart ${testfile} + + if { skip_python_tests } { continue } + ++gdb_test_no_output "python import gdb.events" ++ + set pyfile gdb_remote_download host ${srcdir}/${subdir}/py-events.py + gdb_test_no_output "source ${pyfile}" "load python file" + +-- +2.33.0 +
View file
_service:tar_scm:gdb-Use-bool-for-evregpy_no_listeners_p.patch
Added
@@ -0,0 +1,40 @@ +From 907de931f547bd0d6178ee04bdb6496cd66dbdd7 Mon Sep 17 00:00:00 2001 +From: Tom Tromey <tromey@adacore.com> +Date: Fri, 3 Jun 2022 10:35:30 -0600 +Subject: PATCH Use bool for evregpy_no_listeners_p + +I noticed that evregpy_no_listeners_p should return a bool. This +patch makes this change. I'm checking it in. +--- + gdb/python/py-events.h | 2 +- + gdb/python/py-evtregistry.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h +index bd4a75c..1680b58 100644 +--- a/gdb/python/py-events.h ++++ b/gdb/python/py-events.h +@@ -52,6 +52,6 @@ struct events_object + extern events_object gdb_py_events; + + extern eventregistry_object *create_eventregistry_object (void); +-extern int evregpy_no_listeners_p (eventregistry_object *registry); ++extern bool evregpy_no_listeners_p (eventregistry_object *registry); + + #endif /* PYTHON_PY_EVENTS_H */ +diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c +index 003fe44..ef96c48 100644 +--- a/gdb/python/py-evtregistry.c ++++ b/gdb/python/py-evtregistry.c +@@ -115,7 +115,7 @@ gdbpy_initialize_eventregistry (void) + /* Return the number of listeners currently connected to this + registry. */ + +-int ++bool + evregpy_no_listeners_p (eventregistry_object *registry) + { + return PyList_Size (registry->callbacks) == 0; +-- +2.33.0 +
View file
_service:tar_scm:gdb-initialize-the-data_head-variable-to-eliminate-c.patch
Added
@@ -0,0 +1,45 @@ +From 44ca285b73b68f6a8fa3e89004b510d6b7d98e91 Mon Sep 17 00:00:00 2001 +From: Enze Li <enze.li@hotmail.com> +Date: Sat, 11 Jun 2022 18:36:48 +0800 +Subject: PATCH gdb: initialize the data_head variable to eliminate + compilation warnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On a machine with gcc 12, I get this warning: + + CXX nat/linux-btrace.o +In function ‘btrace_error linux_read_bts(btrace_data_bts*, btrace_target_info*, btrace_read_type)’, + inlined from ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’ at ../gdb/nat/linux-btrace.c:935:29: +../gdb/nat/linux-btrace.c:865:21: warning: ‘data_head’ may be used uninitialized -Wmaybe-uninitialized + 865 | pevent->last_head = data_head; + | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ +../gdb/nat/linux-btrace.c: In function ‘btrace_error linux_read_btrace(btrace_data*, btrace_target_info*, btrace_read_type)’: +../gdb/nat/linux-btrace.c:792:9: note: ‘data_head’ was declared here + 792 | __u64 data_head, data_tail; + | ^~~~~~~~~ + +Fix this by initializing the 'data_head' variable. + +Tested by rebuilding on x86_64 openSUSE Tumbleweed with gcc 12. +--- + gdb/nat/linux-btrace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c +index b0d6dcd7cf1..c31fb5ffe43 100644 +--- a/gdb/nat/linux-btrace.c ++++ b/gdb/nat/linux-btrace.c +@@ -789,7 +789,7 @@ linux_read_bts (struct btrace_data_bts *btrace, + struct perf_event_buffer *pevent; + const uint8_t *begin, *end, *start; + size_t buffer_size, size; +- __u64 data_head, data_tail; ++ __u64 data_head = 0, data_tail; + unsigned int retries = 5; + + pevent = &tinfo->variant.bts.bts; +-- +2.33.0 +
View file
_service:tar_scm:gdb-libctf-update-regexp-to-allow-makeinfo-to-build-docu.patch
Added
@@ -0,0 +1,76 @@ +From 24669c55aed712c192b80456295cce122c7d5f73 Mon Sep 17 00:00:00 2001 +From: Enze Li <enze.li@hotmail.com> +Date: Sat, 14 Jan 2023 11:33:48 +0800 +Subject: PATCH libctf: update regexp to allow makeinfo to build document + +While trying to build gdb on latest openSUSE Tumbleweed, I noticed the +following warning, + + checking for makeinfo... makeinfo --split-size=5000000 + configure: WARNING: + *** Makeinfo is too old. Info documentation will not be built. + +then I checked the version of makeinfo, it said, +====== +$ makeinfo --version +texi2any (GNU texinfo) 7.0.1 + +Copyright (C) 2022 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +====== + +After digging a little bit, it became quite obvious that a dot is +missing in regexp that makes it impossible to match versions higher than +7.0, and here's the solution: + +- | egrep 'texinfo^0-9*(6\.3-9|7-90-9)' >/dev/null 2>&1; then ++ | egrep 'texinfo^0-9*(6\.3-9|7-9\.0-9)' >/dev/null 2>&1; then + +However, Eli pointed out that the solution above has another problem: it +will stop working when Texinfo 10.1 will be released. Meanwhile, he +suggested to solve this problem permanently. That is, we don't care +about the minor version for Texinfo > 6.9, we only care about the major +version. + +In this way, the problem will be resolved permanently, thanks to Eli. + +libctf/ChangeLog: + + * configure: Regenerated. + * configure.ac: Update regexp to match versions higher than 7.0. +--- + libctf/configure | 2 +- + libctf/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libctf/configure b/libctf/configure +index c22f7dffd2c..a0e40f49a80 100755 +--- a/libctf/configure ++++ b/libctf/configure +@@ -14864,7 +14864,7 @@ esac + # We require texinfo to be 6.3 or later, for a working synindex + # and validatemenus: otherwise we fall back to /bin/true. + if ${MAKEINFO} --version \ +- | egrep 'texinfo^0-9*(6\.3-9|7-90-9)' >/dev/null 2>&1; then ++ | egrep 'texinfo^0-9*(6\.3-9|7-9|1-60-9)' >/dev/null 2>&1; then + build_info=yes + else + build_info= +diff --git a/libctf/configure.ac b/libctf/configure.ac +index 1d0cf4d0fa5..6a5eade1855 100644 +--- a/libctf/configure.ac ++++ b/libctf/configure.ac +@@ -184,7 +184,7 @@ changequote(,) + # We require texinfo to be 6.3 or later, for a working synindex + # and validatemenus: otherwise we fall back to /bin/true. + if ${MAKEINFO} --version \ +- | egrep 'texinfo^0-9*(6\.3-9|7-90-9)' >/dev/null 2>&1; then ++ | egrep 'texinfo^0-9*(6\.3-9|7-9|1-60-9)' >/dev/null 2>&1; then + build_info=yes + else + build_info= +-- +2.33.0 +
View file
_service:tar_scm:gdb-python-remove-Python-2-support.patch
Added
@@ -0,0 +1,1375 @@ +From 18a8874936fb0701086108c4dddf26c3072b6bb0 Mon Sep 17 00:00:00 2001 +From: Simon Marchi <simon.marchi@polymtl.ca> +Date: Thu, 23 Dec 2021 20:20:46 -0500 +Subject: PATCH gdb/python: remove Python 2 support + +New in this version: + + - Add a PY_MAJOR_VERSION check in configure.ac / AC_TRY_LIBPYTHON. If + the user passes --with-python=python2, this will cause a configure + failure saying that GDB only supports Python 3. + +Support for Python 2 is a maintenance burden for any patches touching +Python support. Among others, the differences between Python 2 and 3 +string and integer types are subtle. It requires a lot of effort and +thinking to get something that behaves correctly on both. And that's if +the author and reviewer of the patch even remember to test with Python +2. + +See this thread for an example: + + https://sourceware.org/pipermail/gdb-patches/2021-December/184260.html + +So, remove Python 2 support. Update the documentation to state that GDB +can be built against Python 3 (as opposed to Python 2 or 3). + +Update all the spots that use: + + - sys.version_info + - IS_PY3K + - PY_MAJOR_VERSION + - gdb_py_is_py3k + +... to only keep the Python 3 portions and drop the use of some +now-removed compatibility macros. + +I did not update the configure script more than just removing the +explicit references to Python 2. We could maybe do more there, like +check the Python version and reject it if that version is not +supported. Otherwise (with this patch), things will only fail at +compile time, so it won't really be clear to the user that they are +trying to use an unsupported Python version. But I'm a bit lost in the +configure code that checks for Python, so I kept that for later. + +Change-Id: I75b0f79c148afbe3c07ac664cfa9cade052c0c62 +--- + gdb/NEWS | 3 + + gdb/README | 2 +- + gdb/configure | 78 +------------------ + gdb/configure.ac | 18 ++--- + gdb/doc/python.texi | 2 - + gdb/python/lib/gdb/__init__.py | 2 +- + gdb/python/lib/gdb/command/explore.py | 22 +++--- + gdb/python/lib/gdb/printer/bound_registers.py | 7 +- + gdb/python/lib/gdb/printing.py | 9 +-- + gdb/python/lib/gdb/xmethod.py | 8 +- + gdb/python/py-arch.c | 6 -- + gdb/python/py-evts.c | 6 -- + gdb/python/py-framefilter.c | 6 +- + gdb/python/py-membuf.c | 73 +---------------- + gdb/python/py-param.c | 8 -- + gdb/python/py-record-btrace.c | 17 +--- + gdb/python/py-type.c | 13 ---- + gdb/python/py-utils.c | 47 +---------- + gdb/python/py-value.c | 66 ---------------- + gdb/python/python-internal.h | 10 --- + gdb/python/python.c | 19 ----- + gdb/testsuite/gdb.python/py-inferior.exp | 6 +- + .../py-mi-var-info-path-expression.py | 12 +-- + gdb/testsuite/gdb.python/py-record-btrace.exp | 6 +- + gdb/testsuite/gdb.python/py-send-packet.py | 58 ++++---------- + gdb/testsuite/gdb.python/py-shared.exp | 7 +- + gdb/testsuite/gdb.python/py-value.exp | 40 +--------- + gdb/testsuite/lib/gdb.exp | 12 --- + 28 files changed, 61 insertions(+), 502 deletions(-) + +diff --git a/gdb/NEWS b/gdb/NEWS +index 501ace1..c80bf39 100644 +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -180,6 +180,9 @@ GNU/Linux/LoongArch loongarch*-*-linux* + + S+core score-*-* + ++* Remove support for building against Python 2, it is now only possible to ++ build GDB against Python 3. ++ + * Python API + + ** New function gdb.add_history(), which takes a gdb.Value object +diff --git a/gdb/README b/gdb/README +index e65c5ea..bd5a88f 100644 +--- a/gdb/README ++++ b/gdb/README +@@ -506,7 +506,7 @@ more obscure GDB `configure' options are not listed here. + GDB scripting much more powerful than the restricted CLI + scripting language. If your host does not have Python installed, + you can find it on `http://www.python.org/download/'. The oldest +- version of Python supported by GDB is 2.6. The optional argument ++ version of Python supported by GDB is 3.2. The optional argument + PYTHON is used to find the Python headers and libraries. It can + be either the name of a Python executable, or the name of the + directory in which Python is installed. +diff --git a/gdb/configure b/gdb/configure +index ac372e3..1e955a5 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -11764,81 +11764,12 @@ $as_echo_n "checking for python... " >&6; } + int + main () + { +-Py_Initialize (); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- have_libpython=yes +- found_usable_python=yes +- PYTHON_CPPFLAGS=$new_CPPFLAGS +- PYTHON_LIBS=$new_LIBS +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- CPPFLAGS=$save_CPPFLAGS +- LIBS=$save_LIBS +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_python}" >&5 +-$as_echo "${found_usable_python}" >&6; } +- +- elif test "${have_python_config}" != failed; then +- if test "${have_libpython}" = no; then +- +- +- new_CPPFLAGS=${python_includes} +- new_LIBS="-lpython2.7 ${python_libs}" +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +-$as_echo_n "checking for python... " >&6; } +- save_CPPFLAGS=$CPPFLAGS +- save_LIBS=$LIBS +- CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" +- LIBS="$new_LIBS $LIBS" +- found_usable_python=no +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include "Python.h" +-int +-main () +-{ +-Py_Initialize (); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- have_libpython=yes +- found_usable_python=yes +- PYTHON_CPPFLAGS=$new_CPPFLAGS +- PYTHON_LIBS=$new_LIBS +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- CPPFLAGS=$save_CPPFLAGS +- LIBS=$save_LIBS +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_python}" >&5 +-$as_echo "${found_usable_python}" >&6; } + +- fi +- if test "${have_libpython}" = no; then ++ #if PY_MAJOR_VERSION != 3 ++ # error "We only support Python 3" ++ #endif ++ Py_Initialize (); + +- +- new_CPPFLAGS=${python_includes} +- new_LIBS="-lpython2.6 ${python_libs}" +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python" >&5 +-$as_echo_n "checking for python... " >&6; } +- save_CPPFLAGS=$CPPFLAGS +- save_LIBS=$LIBS +- CPPFLAGS="$CPPFLAGS $new_CPPFLAGS" +- LIBS="$new_LIBS $LIBS" +- found_usable_python=no +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-#include "Python.h" +-int +-main () +-{ +-Py_Initialize (); + ; + return 0; + } +@@ -11856,7 +11787,6 @@ rm -f core conftest.err conftest.$ac_objext \ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${found_usable_python}" >&5 + $as_echo "${found_usable_python}" >&6; } + +- fi + fi +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2