[0/8] Arithmetic for 128-bit types

Message ID 20230303211207.1053037-1-tromey@adacore.com
Headers
Series Arithmetic for 128-bit types |

Message

Tom Tromey March 3, 2023, 9:11 p.m. UTC
  This series adss basic arithmetic for 128-bit integer types to gdb.

This is done using GMP, which gdb already requires.  While this
involves extra allocation, my view is that this hardly matters in most
expression contexts.  However, if it does turn out to matter, we can
try to switch to GCC's wide-integer code.

While this series, or something like it, is necessary for supporting
128-bit types, it is not sufficient.  In particular, none of the
lexers or parsers are touched, and integers that are part of types
(e.g., range bounds) are not handled.

This series is based on my earlier series to clean up the GMP classes.

Regression tested on x86-64 Fedora 36.

Tom
  

Comments

Eli Zaretskii March 4, 2023, 7:04 a.m. UTC | #1
> Date: Fri,  3 Mar 2023 14:11:59 -0700
> X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
>  DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,
>  SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
> 
> This series adss basic arithmetic for 128-bit integer types to gdb.

Can you tell where and in what situations will this be useful?

Also, don't we need to announce this, at least in NEWS?

Thanks.
  
Tom Tromey March 8, 2023, 4:17 p.m. UTC | #2
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Fri,  3 Mar 2023 14:11:59 -0700
>> X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
>> DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,
>> SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
>> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
>> 
>> This series adss basic arithmetic for 128-bit integer types to gdb.

Eli> Can you tell where and in what situations will this be useful?

Right now, if the inferior uses 128-bit integer types, then 'print'
works but no other operations work.  So for example, you cannot "print x + 1".

128-bit types are somewhat more common now.  Several of the languages
gdb supports have them (at least C, C++, Rust, and Ada).

Eli> Also, don't we need to announce this, at least in NEWS?

I added this:

    * GDB now has some support for integer types larger than 64 bits.

Tom
  
Tom Tromey March 27, 2023, 2:20 p.m. UTC | #3
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> This series adss basic arithmetic for 128-bit integer types to gdb.
Tom> This is done using GMP, which gdb already requires.  While this
Tom> involves extra allocation, my view is that this hardly matters in most
Tom> expression contexts.  However, if it does turn out to matter, we can
Tom> try to switch to GCC's wide-integer code.

Tom> While this series, or something like it, is necessary for supporting
Tom> 128-bit types, it is not sufficient.  In particular, none of the
Tom> lexers or parsers are touched, and integers that are part of types
Tom> (e.g., range bounds) are not handled.

Tom> This series is based on my earlier series to clean up the GMP classes.

Tom> Regression tested on x86-64 Fedora 36.

I've rebased this and re-run the regression tests.
I'm going to check it in now.

Tom