From 9a13dfbc7937765c772a67f949e1cfa3e7e594cc Mon Sep 17 00:00:00 2001 From: zimmerma Date: Mon, 26 Sep 2011 15:14:59 +0000 Subject: [tests/memory.c] added debug test to isolate a bug on x86_64-darwin (see http://hydra.nixos.org/build/1406145 and http://hydra.nixos.org/build/1405013). Apparently the addresses reported by tests_free() are deterministic. git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1096 211d60ee-9f03-0410-a15a-8952a2c7a4e4 --- tests/memory.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/memory.c b/tests/memory.c index d4f8cf4..0dd2dfc 100644 --- a/tests/memory.c +++ b/tests/memory.c @@ -27,6 +27,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include #include "gmp.h" +#define TEST_MEMORY 0x1002001D0 + #define __gmp_default_allocate malloc #define __gmp_default_reallocate(p,old,new) realloc(p,new) #define __gmp_default_free(p,size) free(p) @@ -90,6 +92,11 @@ tests_allocate (size_t size) h->size = size; h->ptr = __gmp_default_allocate (size); +#ifdef TEST_MEMORY + if (h->ptr == (void*) TEST_MEMORY) + fprintf (stderr, "tests_allocate: allocated %zu at 0x%lX\n", + size, (unsigned long) h->ptr); +#endif return h->ptr; } @@ -126,6 +133,11 @@ tests_reallocate (void *ptr, size_t old_size, size_t new_size) h->size = new_size; h->ptr = __gmp_default_reallocate (ptr, old_size, new_size); +#ifdef TEST_MEMORY + if (h->ptr == (void*) TEST_MEMORY) + fprintf (stderr, "tests_reallocate: reallocated from %zu to %zu at 0x%lX\n", + old_size, new_size, (unsigned long) h->ptr); +#endif return h->ptr; } -- cgit v1.2.1