From b34c74ab9a6b8dc0ace3d0cc67bf62de8a74ea00 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sun, 15 Nov 2020 03:09:44 -0500 Subject: gmp-utils: New API to simply use of GMP's integer/rational/float objects This API was motivated by a number of reasons: - GMP's API does not handle "long long" and "unsigned long long", so using LONGEST and ULONGEST is not straightforward; - Automate the need to initialize GMP objects before use, and clear them when no longer used. However, this API grew also to help with similar matter such as formatting to a string, and also reading/writing fixed-point values from byte buffers. Dedicated unit testing is also added. gdb/ChangeLog: * gmp-utils.h, gmp-utils.h: New file. * unittests/gmp-utils-selftests.c: New file. * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add unittests/gmp-utils-selftests.c. (COMMON_SFILES) Add gmp-utils.c. (HFILES_NO_SRCDIR): Add gmp-utils.h. --- gdb/Makefile.in | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gdb/Makefile.in') diff --git a/gdb/Makefile.in b/gdb/Makefile.in index c461964..9b48f73 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -446,6 +446,7 @@ SELFTESTS_SRCS = \ unittests/filtered_iterator-selftests.c \ unittests/format_pieces-selftests.c \ unittests/function-view-selftests.c \ + unittests/gmp-utils-selftests.c \ unittests/lookup_name_info-selftests.c \ unittests/memory-map-selftests.c \ unittests/memrange-selftests.c \ @@ -1059,6 +1060,7 @@ COMMON_SFILES = \ gdb_regex.c \ gdbarch.c \ gdbtypes.c \ + gmp-utils.c \ gnu-v2-abi.c \ gnu-v3-abi.c \ go-lang.c \ @@ -1304,6 +1306,7 @@ HFILES_NO_SRCDIR = \ gdbthread.h \ gdbtypes.h \ glibc-tdep.h \ + gmp-utils.h \ gnu-nat.h \ go-lang.h \ gregset.h \ -- cgit v1.1