Commit Graph

102 Commits

Author SHA1 Message Date
Ehsan Akhgari
b8bca9ed9c Bug 713278 - Teach NS_StackWalk to walk the stack of other threads too on Windows; r=dbaron 2011-12-23 18:14:09 -05:00
Jeff Walden
4030f75e28 Bug 711799 - Fix a few implicit-declaration warnings in trace-malloc. r=dbaron 2011-12-17 22:56:55 -05:00
Matt Brubeck
1e157aab17 Back out bcf9ce858829 and a3bade82ac92 (bug 711799) for build failures 2011-12-19 10:43:08 -08:00
Jeff Walden
a217822452 Bug 711799 - Fix a few implicit-declaration warnings in trace-malloc. r=dbaron 2011-12-17 22:56:55 -05:00
Rafael Ávila de Espíndola
59b41e200e Bug 696376 - Change how we find critical ranges so that it works on 10.6 too. r=dbaron.
Currently we use dlsym on pthread_cond_wait$UNIX2003 to find a
function that indicates that new_sem_from_pool is on the stack. This
works on 10.5, but on 10.6 I could not find a single reliable
indicator that would work with dlsym.

The good news is that dladdr works with any symbol, not just exported
ones. To find the address of new_sem_from_pool, we set up a malloc logger
and force a call to new_sem_from_pool. From the logger callback we walk
the stack trying dladdr on every address.

To force a call to new_sem_from_pool, the initialization code has to be the
first to use semaphores, so it is now run from NS_LogInit.

This works on 10.6 and 10.5 (but we have to look for
"pthread_cond_wait$UNIX2003"). In 10.7 the call to malloc is gone, so we don't
have to worry about critical addresses on it anymore.
2011-12-02 19:26:04 -05:00
Chris Lord
a73ea11cf3 Backout bug 696376
This broke building on android due to requiring a newer version of unwind.h.
2011-12-02 18:00:58 +00:00
Rafael Ávila de Espíndola
b644e77f68 Bug 696376 - Change how we find critical ranges so that it works on 10.6 too. r=dbaron.
Currently we use dlsym on pthread_cond_wait$UNIX2003 to find a
function that indicates that new_sem_from_pool is on the stack. This
works on 10.5, but on 10.6 I could not find a single reliable
indicator that would work with dlsym.

The good news is that dladdr works with any symbol, not just exported
ones. To find the address of new_sem_from_pool, we set up a malloc logger
and force a call to new_sem_from_pool. From the logger callback we walk
the stack trying dladdr on every address.

To for a call to new_sem_from_pool, the initialization code has to be the
first to use semaphores, so it is now run from NS_LogInit.

This works on 10.6 and 10.5 (but we have to look for
"pthread_cond_wait$UNIX2003"). In 10.7 the call to malloc is gone, so we don't
have to worry about critical addresses on it anymore.
2011-12-01 18:22:00 -05:00
Rafael Ávila de Espíndola
2ec84dccb2 Bug 696376 - If stacks_enabled is false, only walk the stack on OS X 32 bits. r=
dbaron.
The 64 bit stack walks lack the InCriticalRange functionality and it looks like
the extra walks are causing an orange on leaktest on the bot.
2011-11-04 09:49:48 -04:00
Rafael Ávila de Espíndola
5fe934d3ba Bug 696281 - disable trace malloc stacks on OS X too. r=dbaron.
This patch disables trace malloc stacks on OS X too. To make this work,
we still have to look on the stack to decide if we must set immediate_abort,
but we can avoid other work like decoding the addresses.
2011-10-28 18:43:49 -04:00
Mike Hommey
18cd2850ec Bug 658995 part 2 - Use static destructors instead of atexit(). r=bsmedberg 2011-06-15 07:32:03 +02:00
Matt Brubeck
542052b358 Back out 6b23b52e68d6 - e92f98e8a335 (bug 632404, 552864, 658995) because of Tp4 regression. 2011-06-15 09:00:28 -07:00
Mike Hommey
fccd5731e6 Bug 658995 part 2 - Use static destructors instead of atexit(). r=bsmedberg 2011-06-15 07:32:03 +02:00
L. David Baron
6c715ff5ec Initialize the out param from backtrace(). (Bug 549561) r=bsmedberg a2.0=tests 2010-09-21 19:32:48 -07:00
L. David Baron
bae6ccebf1 Add environment variable NS_TRACE_MALLOC_DISABLE_STACKS for disabling the stack-walking part of trace-malloc to improve performance of tinderbox test machines. (Bug 549561) r=bsmedberg a2.0=tests 2010-08-19 09:37:59 -04:00
L. David Baron
db7505cc9b Avoid a lock/unlock pair for each call to |calltree|. (Bug 549561) r=bsmedberg a2.0=tests 2010-08-19 09:37:59 -04:00
Pirkka Kärenlampi
7f66d4ca23 Bug 586944. Make 'backtrace' static to fix issues with the symbol being overriden by system libraries. r=dbaron,a=bsmedberg 2010-08-19 21:35:08 +12:00
L. David Baron
4a7c7eab32 Make trace-malloc malloc hooks work with 64-bit Mac OS X by adjusting types. (Bug 558097, maybe) 2010-04-08 17:21:03 -07:00
Chris Jones
76a23485f7 Bug 529134: Initialize tracemalloc in NS_LogInit() to ensure that tracemalloc is always thread safe. r=bsmedberg r=dbaron 2009-12-29 16:45:59 -06:00
L. David Baron
250d1527f9 Don't rely on NS_TraceMallocStartupArgs to initialize TLS index. (Bug 442192) r=brendan 2009-03-11 07:51:30 -07:00
Ben Turner
47baa0fa73 Bustage fix for bug 478195. 2009-02-17 21:51:50 -08:00
Robert O'Callahan
a7eacba780 Bug 478195 - '[Mac] Same-thread deadlock with trace-malloc (causing random red on OS X 10.5.2 mozilla-central leak test build)'. r=dbaron. 2009-02-17 21:11:29 -08:00
Arpad Borsos
1b55360c07 Bug 456388 - Remove PR_STATIC_CALLBACK and PR_CALLBACK(_DECL) from the tree; r+sr=brendan 2008-10-10 17:04:34 +02:00
L. David Baron
05245c83af Fix broken --shutdown-leaks argument handling on Windows by copying the argument out of argv rather than holding a pointer to it. b=433708 r=pavlov 2008-05-14 11:57:32 -07:00
9a778504b9 Expose trace-malloc stack tracing. b=422847 r=brendan a=NPOTDB 2008-03-14 17:11:37 -07:00
ec7f25b1f6 Fix race saving/restoring malloc hooks by going back to overriding malloc, etc., plus some additional cleanup. b=392009 r+a1.9=brendan 2007-09-28 15:39:59 -07:00
0ee54c81c4 Suppress tracing around calls into original allocators, in case they recur back into our hooks. Fixes most of leak *stats* regression from bug 392009. r+a1.9=brendan 2007-09-25 13:33:37 -07:00
67e7b3c69d Reduce code duplication among platforms, support hooking and unhooking (392009, r=dbaron). 2007-09-24 18:13:17 -07:00
a63fe68680 Port trace-malloc to Mac OS X. b=392118 r+a=brendan 2007-08-14 09:35:46 -07:00
c787064ba0 Make void signatures match header. b=391766 r+a=brendan 2007-08-10 17:53:28 -07:00
96b741af7f Lock around NS_TraceMallocDumpAllocations. b=391766 r+a=brendan 2007-08-10 17:53:02 -07:00
c419659799 Stop using strncpy unnecessarily. b=391766 r+a=brendan 2007-08-10 17:52:35 -07:00
ecec5fd6ab Add suppression code around calls to original allocation functions to handle things like new[] calling new. b=391491 r+a=brendan 2007-08-10 15:22:07 -07:00
fbdc0b76cb Define the __libc_* on Windows to something that does automatic suppression, like on Linux. b=391477 r+a=brendan 2007-08-10 15:21:13 -07:00
21952d5e17 Convert trace-malloc to using XPCOM stack walking API. b=374829 r+a=brendan 2007-08-10 15:20:48 -07:00
47708ab0fa Start reducing the scope of locking in trace-malloc, and convert the PRMonitor to a PRLock. b=376874 r+a=brendan 2007-08-10 15:19:32 -07:00
f53e441157 Use thread-local storage for tracing suppression. b=376874 r+a=brendan 2007-08-10 15:19:14 -07:00
ebfba2a3ed Improve performance when trace-malloc is built but not used by adding a fast-path around the locking. b=150015 r=brendan a=bzbarsky 2007-08-10 14:24:32 -07:00
0d0bfc3a46 Replace printf that fires all the time with an assertion for what I really want to check. 2007-04-03 18:35:35 -07:00
5009b4d172 The tinderbox problem was due to insufficient STARTUP_TMBUFSIZE, so re-increase the buffer size to 64K (from 16K) and comment out my debugging code. 2007-04-03 18:06:34 -07:00
231a265cb8 Back out startup buffer size change (but leave diagnostic). 2007-04-03 17:53:26 -07:00
577a479f32 Try increasing startup buffer size to see if it fixes tinderbox orange. 2007-04-03 17:39:56 -07:00
e07b114d0a Fix deadlock in trace-malloc by exiting monitor around call to dladdr. b=363334 r=brendan 2007-04-03 15:14:01 -07:00
dbaron@dbaron.org
9c24c1dfd6 Make trace-malloc dumps not print '(nil)' instead of an address. b=331743 (fixing regression from previous patch) 2007-02-14 07:07:51 +00:00
dbaron@dbaron.org
8dbb17b8ae Make trace-malloc override additional memory allocation functions. b=331742 2007-02-14 07:06:35 +00:00
dbaron@dbaron.org
e71a5c8b41 Fix relocations that need to be resolved at runtime when building with default visibility as hidden and wrapping system includes. b=358558 r=bsmedberg 2006-10-29 16:11:26 +00:00
dbaron@dbaron.org
e5fa18ef75 Partial 64-bit and x86_64 porting. b=331743 r=brendan 2006-03-27 07:29:32 +00:00
dbaron@dbaron.org
644c6c0fe5 Revert old fix for 230336 in favor of better fix elsewhere. 2006-03-25 04:16:00 +00:00
dbaron@dbaron.org
23eb069efa Fix C++ comments that I introduced. 2006-03-24 08:32:09 +00:00
dbaron@dbaron.org
9af7e4411b Workaround brokenness of __builtin_frame_address(0) on gcc 4.1 (as shipped with FC5, at least). b=331436 r=brendan 2006-03-23 23:21:27 +00:00
dbaron@dbaron.org
0bc0709651 Use __builtin_frame_address instead of setjmp to get the frame pointer. b=323853 r=brendan 2006-03-19 01:27:17 +00:00