Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-21 Thread Chris Johns
On 21/3/2022 5:54 pm, Sebastian Huber wrote:
> On 20/03/2022 23:22, Chris Johns wrote:
>> On 19/3/2022 8:33 pm, Sebastian Huber wrote:
>>> On 18/03/2022 22:56, Chris Johns wrote:

> On 19 Mar 2022, at 2:40 am, Sebastian Huber
>  wrote:
>
> On 17/03/2022 12:51, Sebastian Huber wrote:
>> 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 (),
>>   ^~~

 Has a bug report been raised with gdb?
>>>
>>> The Python 2 EOL was January 1, 2020. This code was added by:
>>>
>>> commit 740b42ceb7c7ae7b5343183782973576a93bc7b3
>>> Author: Andrew Burgess 
>>> Date:   Tue Jun 23 14:45:38 2020 +0100
>>>
>>>  gdb/python/mi: create MI commands using python
>>>
>>> It is not a bug from my point of view.
>>
>> The change has been reviewed again ...
>>
>> commit 5ec0444e8312c17e628739ebd7b8f0e29df3c9e9
>> Author: Andrew Burgess 
>> Date:   Fri Mar 18 15:55:34 2022 +
>>
>>  gdb: supply PyDict_GetItemWithError when compiling with Python2
> 
> Good timing.
> 
> I still think the patch to prefer the Python 3 installation of the Python 2
> installation makes sense. We will have this issue again if I want to build the
> GDB main branch some time in the future.

Yeah I think this is sensible. If we can still build python2 then I am OK with
this change.

> I was able to build the latest GDB with this patch. Otherwise all
> architectures failed with the above error.

 Has gdb dropped Python 2 support?
>>>
>>> It seems so.
>>
>> It seems from above is after gdb 12 has branched. We could settle on gdb 12 
>> for
>> rtems6?
> 
> Given that GDB 12 isn't released yet this doesn't sound like a constraint.
> 

Great. We need to get the tools back to released source for the rtems6 release
so we should track this and then switch.

 What happens on a host without python3 installed? Does the error appear? 
 Does
 this in effect force RTEMS to drop the Python2 requirement for rtems6?
>>>
>>> I guess if we want to use the next GDB release, then Python 3 is required.
>>>
>>
>> Then this changes rtems6 because it forces a major change I had not expected 
>> on
>> to rtems6. I suggest a separate thread be started to again consider removing
>> python 2 support for rtems6. It do not bother me but we have some users 
>> where is
>> may so it is best to ask openly.
> 
> Yes, this makes sense.

Great

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-21 Thread Sebastian Huber



On 20/03/2022 23:22, Chris Johns wrote:

On 19/3/2022 8:33 pm, Sebastian Huber wrote:

On 18/03/2022 22:56, Chris Johns wrote:



On 19 Mar 2022, at 2:40 am, Sebastian Huber
 wrote:

On 17/03/2022 12:51, Sebastian Huber wrote:

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 (),
  ^~~


Has a bug report been raised with gdb?


The Python 2 EOL was January 1, 2020. This code was added by:

commit 740b42ceb7c7ae7b5343183782973576a93bc7b3
Author: Andrew Burgess 
Date:   Tue Jun 23 14:45:38 2020 +0100

     gdb/python/mi: create MI commands using python

It is not a bug from my point of view.


The change has been reviewed again ...

commit 5ec0444e8312c17e628739ebd7b8f0e29df3c9e9
Author: Andrew Burgess 
Date:   Fri Mar 18 15:55:34 2022 +

 gdb: supply PyDict_GetItemWithError when compiling with Python2


Good timing.

I still think the patch to prefer the Python 3 installation of the 
Python 2 installation makes sense. We will have this issue again if I 
want to build the GDB main branch some time in the future.





I was able to build the latest GDB with this patch. Otherwise all
architectures failed with the above error.


Has gdb dropped Python 2 support?


It seems so.


It seems from above is after gdb 12 has branched. We could settle on gdb 12 for
rtems6?


Given that GDB 12 isn't released yet this doesn't sound like a constraint.





What happens on a host without python3 installed? Does the error appear? Does
this in effect force RTEMS to drop the Python2 requirement for rtems6?


I guess if we want to use the next GDB release, then Python 3 is required.



Then this changes rtems6 because it forces a major change I had not expected on
to rtems6. I suggest a separate thread be started to again consider removing
python 2 support for rtems6. It do not bother me but we have some users where is
may so it is best to ask openly.


Yes, this makes sense.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-20 Thread Chris Johns
On 19/3/2022 8:33 pm, Sebastian Huber wrote:
> On 18/03/2022 22:56, Chris Johns wrote:
>>
>>> On 19 Mar 2022, at 2:40 am, Sebastian Huber
>>>  wrote:
>>>
>>> On 17/03/2022 12:51, Sebastian Huber wrote:
 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 (),
  ^~~
>>
>> Has a bug report been raised with gdb?
> 
> The Python 2 EOL was January 1, 2020. This code was added by:
> 
> commit 740b42ceb7c7ae7b5343183782973576a93bc7b3
> Author: Andrew Burgess 
> Date:   Tue Jun 23 14:45:38 2020 +0100
> 
>     gdb/python/mi: create MI commands using python
> 
> It is not a bug from my point of view.

The change has been reviewed again ...

commit 5ec0444e8312c17e628739ebd7b8f0e29df3c9e9
Author: Andrew Burgess 
Date:   Fri Mar 18 15:55:34 2022 +

gdb: supply PyDict_GetItemWithError when compiling with Python2

Commit

  commit 740b42ceb7c7ae7b5343183782973576a93bc7b3
  Date:   Tue Jun 23 14:45:38 2020 +0100

  gdb/python/mi: create MI commands using python

Introduced a use of PyDict_GetItemWithError, which is not available in
Python2, and so the Python2 build was broken.

This commit provides a work around for this:

  #define PyDict_GetItemWithError PyDict_GetItem

The arguments passed to these calls are identical, the difference is
that the WithError version will return with an exception raised in
some error cases, while the PyDict_GetItem suppresses some errors, and
just returns nullptr.

Given that we are almost at the GDB 12 branch point, this commit is
the easiest change to get the Python2 build working again.  After GDB
12 branches the plan is to remove Python2 support, so this #define
will be removed anyway.

As far as functionality I think this #define will be fine.  In the
"normal" no error case, then obviously, everything will be fine.  The
only difference is what happens when an error occurs.

The only errors I think could happen if Python runs into problems
hashing the string, or comparing the strings for equality.  Given the
limited strings we're working with I don't expect that this should
occur during normal operation.  So, my expectation is that this should
only happen if they user has gone and messed around with this hash in
some way - in which case I think it's OK if weird things happen.

This issue was discussed on IRC, and I think Simon might be working on
an alternative patch to remove the _mi_commands dictionary from the
gdb module, in which case the use of PyDict_GetItemWithError will be
removed completely.  I'm posting this just in case people want to
consider a minimal work around for the breakage in the short term.

>>> I was able to build the latest GDB with this patch. Otherwise all
>>> architectures failed with the above error.
>>
>> Has gdb dropped Python 2 support?
> 
> It seems so.

It seems from above is after gdb 12 has branched. We could settle on gdb 12 for
rtems6?

>>
>> What happens on a host without python3 installed? Does the error appear? Does
>> this in effect force RTEMS to drop the Python2 requirement for rtems6?
> 
> I guess if we want to use the next GDB release, then Python 3 is required.
> 

Then this changes rtems6 because it forces a major change I had not expected on
to rtems6. I suggest a separate thread be started to again consider removing
python 2 support for rtems6. It do not bother me but we have some users where is
may so it is best to ask openly.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-19 Thread Sebastian Huber



On 18/03/2022 22:56, Chris Johns wrote:



On 19 Mar 2022, at 2:40 am, Sebastian Huber 
 wrote:

On 17/03/2022 12:51, Sebastian Huber wrote:

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 (),
 ^~~


Has a bug report been raised with gdb?


The Python 2 EOL was January 1, 2020. This code was added by:

commit 740b42ceb7c7ae7b5343183782973576a93bc7b3
Author: Andrew Burgess 
Date:   Tue Jun 23 14:45:38 2020 +0100

gdb/python/mi: create MI commands using python

It is not a bug from my point of view.




I was able to build the latest GDB with this patch. Otherwise all architectures 
failed with the above error.


Has gdb dropped Python 2 support?


It seems so.



What happens on a host without python3 installed? Does the error appear? Does 
this in effect force RTEMS to drop the Python2 requirement for rtems6?


I guess if we want to use the next GDB release, then Python 3 is required.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-18 Thread Chris Johns

> On 19 Mar 2022, at 2:40 am, Sebastian Huber 
>  wrote:
> 
> On 17/03/2022 12:51, Sebastian Huber wrote:
>> 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 (),
>> ^~~

Has a bug report been raised with gdb?

> I was able to build the latest GDB with this patch. Otherwise all 
> architectures failed with the above error.

Has gdb dropped Python 2 support?

What happens on a host without python3 installed? Does the error appear? Does 
this in effect force RTEMS to drop the Python2 requirement for rtems6?

Chris


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] GDB: Prefer Python 3 over 2

2022-03-18 Thread Sebastian Huber

On 17/03/2022 12:51, Sebastian Huber wrote:

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 (),
 ^~~


I was able to build the latest GDB with this patch. Otherwise all 
architectures failed with the above error.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
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/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel