RFC: making GMP a required dependency of GDB

Joel Brobecker brobecker@adacore.com
Tue Mar 6 16:44:00 GMT 2018


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,
-- 
Joel



More information about the Gdb-patches mailing list