diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/nautilus-leak-checker.c | 27 | ||||
-rw-r--r-- | test/nautilus-leak-symbol-lookup.c | 6 |
2 files changed, 20 insertions, 13 deletions
diff --git a/test/nautilus-leak-checker.c b/test/nautilus-leak-checker.c index c8b1c4071..8e17afc15 100644 --- a/test/nautilus-leak-checker.c +++ b/test/nautilus-leak-checker.c @@ -31,6 +31,7 @@ #include <malloc.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "nautilus-leak-checker-stubs.h" #include "nautilus-leak-hash-table.h" @@ -255,13 +256,13 @@ nautilus_leak_record_malloc (void *ptr, size_t size) if (hash_table == NULL) { hash_table = nautilus_leak_hash_table_new (10 * 1024); } - if (nautilus_leak_hash_table_find (hash_table, (guint)ptr) != NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)ptr) != NULL) { printf("*** block %p appears to already be allocated " "- someone must have sneaked a free past us\n", ptr); - nautilus_leak_hash_table_remove (hash_table, (guint)ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)ptr); } /* insert a new item into the hash table, using the block address as the key */ - element = nautilus_leak_hash_table_add (hash_table, (guint)ptr); + element = nautilus_leak_hash_table_add (hash_table, (gulong)ptr); /* fill out the new allocated element */ nautilus_leak_allocation_record_init (&element->data, ptr, size, trace_array, TRACE_ARRAY_MAX); @@ -287,22 +288,22 @@ nautilus_leak_record_realloc (void *old_ptr, void *new_ptr, size_t size) /* must have hash table by now */ g_assert (hash_table != NULL); /* must have seen the block already */ - if (nautilus_leak_hash_table_find (hash_table, (guint)old_ptr) == NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)old_ptr) == NULL) { printf("*** we haven't seen block %p yet " "- someone must have sneaked a malloc past us\n", old_ptr); } else { - nautilus_leak_hash_table_remove (hash_table, (guint)old_ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)old_ptr); } /* shouldn't have this block yet */ - if (nautilus_leak_hash_table_find (hash_table, (guint)new_ptr) != NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)new_ptr) != NULL) { printf("*** block %p appears to already be allocated " "- someone must have sneaked a free past us\n", new_ptr); - nautilus_leak_hash_table_remove (hash_table, (guint)new_ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)new_ptr); } /* insert a new item into the hash table, using the block address as the key */ - element = nautilus_leak_hash_table_add (hash_table, (guint)new_ptr); + element = nautilus_leak_hash_table_add (hash_table, (gulong)new_ptr); /* Fill out the new allocated element. * This way the last call to relloc will be the stack crawl that shows up in the @@ -327,11 +328,11 @@ nautilus_leak_record_free (void *ptr) /* must have hash table by now */ g_assert (hash_table != NULL); /* must have seen the block already */ - if (nautilus_leak_hash_table_find (hash_table, (guint)ptr) == NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)ptr) == NULL) { printf("*** we haven't seen block %p yet " "- someone must have sneaked a malloc past us\n", ptr); } else { - nautilus_leak_hash_table_remove (hash_table, (guint)ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)ptr); } pthread_mutex_unlock (&nautilus_leak_hash_table_mutex); @@ -513,8 +514,8 @@ print_one_leak (NautilusLeakTableEntry *entry, void *context) int index; PrintOneLeakParams *params = (PrintOneLeakParams *)context; - printf("block %p total_size %d count %d\n", entry->sample_allocation->block, - entry->total_size, entry->count); + printf("block %p total_size %ld count %d\n", entry->sample_allocation->block, + (long)entry->total_size, entry->count); for (index = 0; index < params->stack_print_depth; index++) { /* only print stack_grouping worth of stack crawl - @@ -715,4 +716,4 @@ main (int argc, char **argv) } -#endif
\ No newline at end of file +#endif diff --git a/test/nautilus-leak-symbol-lookup.c b/test/nautilus-leak-symbol-lookup.c index d7f8b8640..105b8d014 100644 --- a/test/nautilus-leak-symbol-lookup.c +++ b/test/nautilus-leak-symbol-lookup.c @@ -103,8 +103,14 @@ nautilus_leak_symbol_map_get_offsets (NautilusLeakSymbolLookupMap *map) while (fgets(buffer, 1023, in)) { +/* if long is in fact the int64 type */ +#if G_MAXLONG == 9223372036854775807 + count = sscanf (buffer, "%lx-%lx %15s %*x %u:%u %lu %255s", + &start, &end, perms, &major, &minor, &inode, file); +#else count = sscanf (buffer, "%Lx-%Lx %15s %*x %u:%u %Lu %255s", &start, &end, perms, &major, &minor, &inode, file); +#endif if (count >= 6 && strcmp (perms, "r-xp") == 0) { if (stat (file, &entry_stat) != 0) { |