зеркало из https://github.com/mozilla/gecko-dev.git
Bug 435122 - "Use TraceMalloc to get stack traces of potential deadlocks". r=bsmedberg+dbaron.
This commit is contained in:
Родитель
e9cad8d128
Коммит
fee386e2e0
|
@ -160,16 +160,7 @@ ifdef _MSC_VER
|
|||
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
|
||||
ifndef BUILD_STATIC_LIBS
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
# when libxul is enabled, trace-malloc is part of it
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
EXTRA_DSO_LIBS += tracemalloc
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
ifdef BUILD_STATIC_LIBS
|
||||
include $(topsrcdir)/config/static-config.mk
|
||||
|
||||
EXTRA_DEPS += \
|
||||
|
|
|
@ -216,10 +216,6 @@ EXTRA_DSO_LDOPTS = \
|
|||
$(MOZ_JS_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
EXTRA_DSO_LIBS += tracemalloc
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_GTK2
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) \
|
||||
-lXrender \
|
||||
|
|
|
@ -168,13 +168,6 @@ GARBAGE += \
|
|||
$(RDF_UTIL_SRC_LCPPSRCS) \
|
||||
$(NULL)
|
||||
endif
|
||||
else
|
||||
ifdef NS_TRACE_MALLOC
|
||||
# In libxul builds, tracemalloc is part of libxul instead.
|
||||
ifndef MOZ_ENABLE_LIBXUL
|
||||
EXTRA_DSO_LIBS += tracemalloc
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
|
||||
|
|
|
@ -347,7 +347,3 @@ endif
|
|||
ifdef GC_LEAK_DETECTOR
|
||||
EXTRA_DSO_LIBS += boehm
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
STATIC_LIBS += tracemalloc
|
||||
endif
|
||||
|
|
|
@ -78,10 +78,6 @@ endif
|
|||
# tier "gecko" - core components
|
||||
#
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
tier_gecko_dirs += tools/trace-malloc/lib
|
||||
endif
|
||||
|
||||
tier_gecko_dirs += \
|
||||
js/src/xpconnect \
|
||||
intl/chardet \
|
||||
|
|
|
@ -84,8 +84,6 @@ ifdef MOZ_ENABLE_LIBXUL
|
|||
ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
EXTRA_DSO_LIBS = xul
|
||||
endif
|
||||
else
|
||||
EXTRA_DSO_LIBS = tracemalloc
|
||||
endif
|
||||
|
||||
LIBS += \
|
||||
|
|
|
@ -46,6 +46,9 @@ MODULE = tracemalloc
|
|||
LIBRARY_NAME = tracemalloc
|
||||
EXPORT_LIBRARY = 1
|
||||
DEFFILE = $(win_srcdir)/tm.def
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
REQUIRES = xpcom
|
||||
|
|
|
@ -37,4 +37,8 @@
|
|||
|
||||
TIERS += xpcom
|
||||
|
||||
tier_xpcom_dirs = xpcom
|
||||
ifdef NS_TRACE_MALLOC
|
||||
tier_xpcom_dirs = tools/trace-malloc/lib
|
||||
endif
|
||||
|
||||
tier_xpcom_dirs += xpcom
|
||||
|
|
|
@ -78,6 +78,10 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
REQUIRES += macmorefiles
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
REQUIRES += tracemalloc
|
||||
endif
|
||||
|
||||
CSRCS = \
|
||||
$(XPCOM_GLUE_SRC_LCSRCS) \
|
||||
$(NULL)
|
||||
|
@ -119,6 +123,12 @@ SHARED_LIBRARY_LIBS = \
|
|||
../string/src/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
SHARED_LIBRARY_LIBS += \
|
||||
$(DEPTH)/tools/trace-malloc/lib/$(LIB_PREFIX)tracemalloc.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I.. \
|
||||
|
|
|
@ -55,6 +55,10 @@ REQUIRES = \
|
|||
string \
|
||||
$(NULL)
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
REQUIRES += tracemalloc
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../build \
|
||||
$(NULL)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsDebug.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#ifdef NS_TRACE_MALLOC_XXX
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
# include <stdio.h>
|
||||
# include "nsTraceMalloc.h"
|
||||
#endif
|
||||
|
@ -60,7 +60,7 @@ static const char* const LockTypeNames[] = {"Lock", "Monitor", "CMonitor"};
|
|||
struct nsNamedVector : public nsVoidArray {
|
||||
const char* mName;
|
||||
|
||||
#ifdef NS_TRACE_MALLOC_XXX
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
// Callsites for the inner locks/monitors stored in our base nsVoidArray.
|
||||
// This array parallels our base nsVoidArray.
|
||||
nsVoidArray mInnerSites;
|
||||
|
@ -257,7 +257,7 @@ static PRBool WellOrdered(const void* addr1, const void* addr2,
|
|||
// Assert (addr1 < addr2) into the order table.
|
||||
// XXX fix plvector/nsVector to use const void*
|
||||
vec1->AppendElement((void*) addr2);
|
||||
#ifdef NS_TRACE_MALLOC_XXX
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
vec1->mInnerSites.AppendElement((void*) callsite2);
|
||||
#endif
|
||||
}
|
||||
|
@ -285,8 +285,8 @@ nsAutoLockBase::nsAutoLockBase(void* addr, nsAutoLockType type)
|
|||
// lock at all, and NSPR will assert if you enter it.
|
||||
} else {
|
||||
const void* node =
|
||||
#ifdef NS_TRACE_MALLOC_XXX
|
||||
NS_GetStackTrace(1)
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
(const void*)NS_TraceMallocGetStackTrace();
|
||||
#else
|
||||
nsnull
|
||||
#endif
|
||||
|
@ -305,12 +305,14 @@ nsAutoLockBase::nsAutoLockBase(void* addr, nsAutoLockType type)
|
|||
vec2->mName ? vec2->mName : "",
|
||||
LockTypeNames[type],
|
||||
addr);
|
||||
#ifdef NS_TRACE_MALLOC_XXX
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
fprintf(stderr, "\n*** %s\n\nCurrent stack:\n", buf);
|
||||
NS_DumpStackTrace(node, stderr);
|
||||
NS_TraceMallocPrintStackTrace(stderr,
|
||||
NS_TraceMallocGetStackTrace());
|
||||
|
||||
fputs("\nPrevious stack:\n", stderr);
|
||||
NS_DumpStackTrace(vec2->mInnerSites.ElementAt(i2), stderr);
|
||||
NS_TraceMallocPrintStackTrace(stderr,
|
||||
(nsTMStackTraceIDStruct *)vec2->mInnerSites.ElementAt(i2));
|
||||
putc('\n', stderr);
|
||||
#endif
|
||||
NS_ERROR(buf);
|
||||
|
|
|
@ -148,10 +148,6 @@ ifdef _MSC_VER
|
|||
WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
|
||||
endif
|
||||
|
||||
ifdef NS_TRACE_MALLOC
|
||||
EXTRA_DSO_LIBS += tracemalloc
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
|
||||
RCINCLUDE = splash.rc
|
||||
|
|
Загрузка…
Ссылка в новой задаче