[PATCH] GDB: fix python config command line arguments based on python version
Karel Gardas
karel at functional.vision
Wed Apr 20 18:30:43 UTC 2022
Fixes #4631
---
source-builder/config/gdb-common-1.cfg | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/source-builder/config/gdb-common-1.cfg b/source-builder/config/gdb-common-1.cfg
index c7f39552..dba6f212 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -109,7 +109,13 @@
%endif
%if %{gdb-python-config} != %{nil}
%define gdb-python-lib-filter awk 'BEGIN{FS=" "}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print "lib"substr($i,3)"*";}'
- %if %{gdb-python-ver-mm} < 3.8
+ %define gdb-python-ver-mm-major %(echo "%{gdb-python-ver-mm}" | sed -e 's/\..*//')
+ %define gdb-python-ver-mm-minor %(echo "%{gdb-python-ver-mm}" | sed -e 's/.*\.//')
+ # following comparion works correctly even for python 2 as it ends with version 2.7.x
+ # so we do not get possibly problematic 2.8 and others here.
+ # Note: int(...) usage is necessary in order to enforce numerical comparison instead of lexicographical
+ # if we do not use that then 10 < 8 would be true
+ %if int(%{gdb-python-ver-mm-major}) <= 3 && int(%{gdb-python-ver-mm-major}) < 8
%define gdb-python-config-lib-check-flags --ldflags
%else
%define gdb-python-config-lib-check-flags --ldflags --embed
--
2.25.1
More information about the devel
mailing list