Make trace-malloc malloc hooks work with 64-bit Mac OS X by adjusting types. (Bug 558097, maybe)
authorL. David Baron <dbaron@dbaron.org>
Thu, 08 Apr 2010 17:21:03 -0700
changeset 40614 0b85f374e62367affbcfae64490ea0bbd1d048c9
parent 40613 4c1ed264c69d00ff305f44b11dcca17534472ae4
child 40615 ef7261b4a589b80fad9887614c57e3f374a456c4
push id12704
push userdbaron@mozilla.com
push dateFri, 09 Apr 2010 00:22:08 +0000
treeherdermozilla-central@0b85f374e623 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs558097
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Make trace-malloc malloc hooks work with 64-bit Mac OS X by adjusting types. (Bug 558097, maybe)
tools/trace-malloc/lib/nsTraceMalloc.c
--- a/tools/trace-malloc/lib/nsTraceMalloc.c
+++ b/tools/trace-malloc/lib/nsTraceMalloc.c
@@ -1063,34 +1063,34 @@ static PLHashTable *new_allocations(void
 }
 
 #define get_allocations() (allocations ? allocations : new_allocations())
 
 #if defined(XP_MACOSX)
 
 /* from malloc.c in Libc */
 typedef void
-malloc_logger_t(unsigned type, unsigned arg1, unsigned arg2, unsigned arg3,
-                unsigned result, unsigned num_hot_frames_to_skip);
+malloc_logger_t(uint32_t type, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
+                uintptr_t result, uint32_t num_hot_frames_to_skip);
 
 extern malloc_logger_t *malloc_logger;
 
 #define MALLOC_LOG_TYPE_ALLOCATE        2
 #define MALLOC_LOG_TYPE_DEALLOCATE      4
 #define MALLOC_LOG_TYPE_HAS_ZONE        8
 #define MALLOC_LOG_TYPE_CLEARED         64
 
 static void
-my_malloc_logger(unsigned type, unsigned arg1, unsigned arg2, unsigned arg3,
-                 unsigned result, unsigned num_hot_frames_to_skip)
+my_malloc_logger(uint32_t type, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
+                 uintptr_t result, uint32_t num_hot_frames_to_skip)
 {
-    unsigned all_args[3] = { arg1, arg2, arg3 };
-    unsigned *args = all_args + ((type & MALLOC_LOG_TYPE_HAS_ZONE) ? 1 : 0);
+    uintptr_t all_args[3] = { arg1, arg2, arg3 };
+    uintptr_t *args = all_args + ((type & MALLOC_LOG_TYPE_HAS_ZONE) ? 1 : 0);
 
-    unsigned alloc_type =
+    uint32_t alloc_type =
         type & (MALLOC_LOG_TYPE_ALLOCATE | MALLOC_LOG_TYPE_DEALLOCATE);
     tm_thread *t = tm_get_thread();
 
     if (alloc_type == (MALLOC_LOG_TYPE_ALLOCATE | MALLOC_LOG_TYPE_DEALLOCATE)) {
         ReallocCallback((void*)args[0], (void*)result, args[1], 0, 0, t);
     } else if (alloc_type == MALLOC_LOG_TYPE_ALLOCATE) {
         /*
          * We don't get size/count information for calloc, so just use