RFC: making GMP a required dependency of GDB

Simon Marchi simark@simark.ca
Wed Mar 7 21:27:00 GMT 2018


On 2018-03-06 11:43 AM, Joel Brobecker wrote:
> Hello,
> 
> I'm currently working on getting back up to speed with the current
> master branch, and once that's done, one of my goals is to contribute
> support for fixed point types described using standard DWARF DIEs.
> Fixed point types are, at the root, integer types to which we apply
> a scaling factor, with that scaling factor being a rational number.
> Depending on the precision, the denominator can be a very large number.
> For instance, if you consider the following type declaration (which
> I didn't invent for the purpose of this, but actually got asked to
> consider):
> 
>    Delta4 : constant := 0.000_000_000_000_000_000_1;
>    type FP4_Type is delta Delta4 range 0.0 .. Delta4 * 10
>       with Small => Delta4 / 3.0;
> 
> In this case, the scaling factor is equival to 1 divided by 3*10^19,
> and that denominator is beyond what even a ULONGEST can hold.
> 
> I have an implementation which uses ULONGEST as the numerator
> and denominator of the scaling factor, but it overflows for
> the type above.
> 
> I'd like to propose that we make GMP a required dependency.
> With that, I could use GMP's rational numbers and overflow
> or loss of precision would no longer be a concern. But I think
> we'll be able to find some other areas where it's going to be
> convenient to handle arbitrarily large numbers without having
> to worry about the size of ULONGEST on the host.
> 
> The alternative is to make the GMP dependency optional, and
> provide an abstraction layer on top of it. But this means
> this basically means we have to re-implement a poorly tested
> and known-to-be-limited version of the subset of GMP we are
> planning on using.
> 
> GMP seems to be  portable, and we know that it is a requirement
> already for building GCC, so we know that it should be available
> on all the platforms where GCC runs. If GCC showed it can be made
> a requirement, I think GDB can too.
> 
> Opinions?
> 
> Thanks,

I don't have any objection.  As you said, it is likely that it will
already be available on the machine where GDB will run.

Simon



More information about the Gdb-patches mailing list