GMP library function body implementations

Evgeny Rovinsky evgeny.rovinsky at
Thu Jan 26 19:16:44 CET 2012

I've been running the GMP 5.0.2 'make check' and encountered some fails
because of my CPU errors. (FYI, the GMP library has been built natively on
MIPS32 system.)

I debug one of these tests (tests/mpz/convert.c). The GMP library is built
with the debug flag (-g) so I hoped to be able to debug the inside of GMP
library functions. However, I fail to do it.

The reason is that the function implementations (e.g. mpz_get_str) is
replaced in code with another function (__gmpz_get_str). Of course, one can
see the define '#define mpz_get_str __gmpz_get_str' in gmp.h header. But
where is the source that becomes the '__gmpz_get_str' code? I couldn't have
found it. The process of GMP library compiling is not quite clear for me.

I tried to change the implementation of 'mpz_get_str' in 'dumbmp.c', but it
had only affected the process of GMP build. After the library was built,
the implementation of 'mpz_get_str' (really '__gmpz_get_str') had remained

Is there a way to find the modifiable code for these functions
('mpz_get_str', as well as 'mpz_set_str_or_abort', 'mpz_cmp' etc.) in order
to modify the source, rebuild and debug it to find my error?

Thanks in advance,
Evgeny Rovinsky.

More information about the gmp-bugs mailing list