[PATCH] GDB: Prefer Python 3 over 2

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Mar 17 11:51:46 UTC 2022


This fixes the build of a recent GDB version:

gdb/python/py-micmd.c: In function 'int micmdpy_uninstall_command(micmdpy_object*)':
gdb/python/py-micmd.c:430:20: error: 'PyDict_GetItemWithError' was not declared in this scope
   PyObject *curr = PyDict_GetItemWithError (mi_cmd_dict.get (),
                    ^~~~~~~~~~~~~~~~~~~~~~~
---
 source-builder/config/gdb-common-1.cfg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source-builder/config/gdb-common-1.cfg b/source-builder/config/gdb-common-1.cfg
index 397d44d..c7f3955 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -42,7 +42,7 @@
 # 2. Does the version of gdb specify a version of python that must be
 #    used. Override with '%define gdb-python-version python2'.
 #
-# 3. Search for 'python2' and if not found search for 'python3'.
+# 3. Search for 'python3' and if not found search for 'python2'.
 #
 %if %{defined gdb-python2}
   %define gdb-enable-python %{gdb_python2}
@@ -53,9 +53,9 @@
     %if %{defined gdb-python-version}
       %define gdb-enable-python %(command -v %{gdb-python-version} || true)
     %else
-      %define gdb-enable-python %(command -v python2 || true)
+      %define gdb-enable-python %(command -v python3 || true)
       %if %{gdb-enable-python} == %{nil}
-        %define gdb-enable-python %(command -v python3 || true)
+        %define gdb-enable-python %(command -v python2 || true)
       %endif
       %if %{gdb-enable-python} == %{nil}
           %define gdb-enable-python %(command -v python || true})
-- 
2.34.1



More information about the devel mailing list