[PATCH 2/2] gdb: Split python's version into major/minor and check for embed option

Frank Kühndel frank.kuehndel at embedded-brains.de
Mon Apr 25 18:01:48 UTC 2022


Hi Chris,

I tested your two patches for ARM on top of
990e3f05e62cf48117f6de8346e9ea8a8d9b1ba3 (Git master
rtems-source-builder, RTEMS 6) on the following OS:

* openSUSE Leap 15.3 Python 2.7.18
* openSUSE Leap 15.3 Python 3.6.15
* Ubuntu 22.04 LTS Python 3.10.4
* AlmaLinux 8.5 (Arctic Sphynx) Python 3.6.8
* Debian GNU/Linux 11 (bullseye) Python 3.9.2
* Fedora Linux 35 (Container Image) Python 3.10.4

Everything worked fine. But inspecting the code, I wonder about this line:

    %if %{gdb-python-ver-major} <= 3 && %{gdb-python-ver-minor} < 8

What if the Python version would be 2.9? (No, I do not I believe that I
will ever see Python 2.8 or 2.9.)

Many thanks for your efforts
fk



This is the output from the RSB log on Fedora:

config: source-builder/config/gdb-common-1.cfg: 114:>%if
%{gdb-python-ver-major}
 <= 3 && %{gdb-python-ver-minor} < 8 [True]
config: source-builder/config/gdb-common-1.cfg: 114:  _if[1]: ['3',
'<=', '3', '
&&', '10', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: AND found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: next OP
found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('3',
'<=', '3') True none True
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: joining: and
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('10',
'<', '8') False and False
config: source-builder/config/gdb-common-1.cfg: 114:  _ifs[2]: dir=None
3 ['10', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 115: %define
gdb-python-config-lib-check-flags --ldflags [False]
config: source-builder/config/gdb-common-1.cfg: 116: %else [False]
config: source-builder/config/gdb-common-1.cfg: 117:>%define
gdb-python-config-lib-check-flags --ldflags --embed [True]
config: source-builder/config/gdb-common-1.cfg: 118:>%endif [True]
config: source-builder/config/gdb-common-1.cfg: 118:  _ifs[2]: %endif:
dir=None %endif True []
config: source-builder/config/gdb-common-1.cfg: 118:  _if[1]: []
config: source-builder/config/gdb-common-1.cfg: 119:>%define
gdb-python-config-libs %(%{gdb-python-config}
%{gdb-python-config-lib-check-flags} | %{gdb-python-lib-filter}) [True]
exe: shell: /usr/bin/python3-config --ldflags --embed | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
exe: /usr/bin/python3-config --ldflags --embed | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
shell-output: 0 libpython3.10*


This is the RSB log output on AlmaLinux:

config: source-builder/config/gdb-common-1.cfg: 114:>%if
%{gdb-python-ver-major} <= 3 && %{gdb-python-ver-minor} < 8 [True]
config: source-builder/config/gdb-common-1.cfg: 114:  _if[1]: ['3',
'<=', '3', '&&', '6', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: AND found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: next OP
found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('3',
'<=', '3') True none True
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: joining: and
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('6',
'<', '8') True and True
config: source-builder/config/gdb-common-1.cfg: 114:  _ifs[2]: dir=None
3 ['6', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 115:>%define
gdb-python-config-lib-check-flags --ldflags [True]
config: source-builder/config/gdb-common-1.cfg: 116:>%else [True]
config: source-builder/config/gdb-common-1.cfg: 117: %define
gdb-python-config-lib-check-flags --ldflags --embed [False]
config: source-builder/config/gdb-common-1.cfg: 118: %endif [False]
config: source-builder/config/gdb-common-1.cfg: 118:  _ifs[2]: %endif:
dir=None %endif False []
config: source-builder/config/gdb-common-1.cfg: 118:  _if[1]: []
config: source-builder/config/gdb-common-1.cfg: 119:>%define
gdb-python-config-libs %(%{gdb-python-config}
%{gdb-python-config-lib-check-flags} | %{gdb-python-lib-filter}) [True]
exe: shell: /usr/bin/python3-config --ldflags | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
exe: /usr/bin/python3-config --ldflags | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
shell-output: 0 libpython3.6m*


This is the output from the RSB log on OpenSUSE (Python 2.7.18):

config: source-builder/config/gdb-common-1.cfg: 114:>%if
%{gdb-python-ver-major} <= 3 && %{gdb-python-ver-minor} < 8 [True]
config: source-builder/config/gdb-common-1.cfg: 114:  _if[1]: ['2',
'<=', '3', '&&', '7', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: AND found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: next OP
found at 3
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('2',
'<=', '3') True none True
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]: joining: and
config: source-builder/config/gdb-common-1.cfg: 114:  _if: numeric value
check
config: source-builder/config/gdb-common-1.cfg: 114:  _if[2]:  ('7',
'<', '8') True and True
config: source-builder/config/gdb-common-1.cfg: 114:  _ifs[2]: dir=None
3 ['7', '<', '8']
config: source-builder/config/gdb-common-1.cfg: 115:>%define
gdb-python-config-lib-check-flags --ldflags [True]
config: source-builder/config/gdb-common-1.cfg: 116:>%else [True]
config: source-builder/config/gdb-common-1.cfg: 117: %define
gdb-python-config-lib-check-flags --ldflags --embed [False]
config: source-builder/config/gdb-common-1.cfg: 118: %endif [False]
config: source-builder/config/gdb-common-1.cfg: 118:  _ifs[2]: %endif:
dir=None %endif False []
config: source-builder/config/gdb-common-1.cfg: 118:  _if[1]: []
config: source-builder/config/gdb-common-1.cfg: 119:>%define
gdb-python-config-libs %(%{gdb-python-config}
%{gdb-python-config-lib-check-flags} | %{gdb-python-lib-filter}) [True]
exe: shell: /usr/bin/python2-config --ldflags | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
exe: /usr/bin/python2-config --ldflags | awk 'BEGIN{FS="
"}/python/{for(i=1;i<NF;++i)if(match($i,".*lpython.*")) print
"lib"substr($i,3)"*";}'
shell-output: 0 libpython2.7*


-- 
embedded brains GmbH
Herr Frank KÜHNDEL
Dornierstr. 4
82178 Puchheim
Germany
email: frank.kuehndel at embedded-brains.de
phone: +49-89-18 94 741 - 23
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list