From 0df019b037f83d0838636d3e70ba830e301f7dc1 Mon Sep 17 00:00:00 2001 From: "seawood%netscape.com" Date: Tue, 26 Feb 2002 09:26:10 +0000 Subject: [PATCH] This patch: * Changes MOZ_TRACE_MALLOC ifdefs to NS_TRACE_MALLOC ifdefs * Links against the trace-malloc utils against libxpcom instead of just xpcomds * Builds NSPR in debug mode on win32 if trace-malloc is enabled * Adds a few "defined()" checks to diffbloatdump.pl so that it will work for perl 5.6.1 * Adds a couple of checks for \r so that diffbloatdump.pl works on win32. Bug #126915 r=bryner/dbaron a=asa --- config/config.mk | 18 ++++++++---------- tools/trace-malloc/Makefile.in | 2 +- tools/trace-malloc/diffbloatdump.pl | 10 ++++++---- xpcom/base/Makefile.in | 5 ++++- xpcom/build/Makefile.in | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/config/config.mk b/config/config.mk index 77f6fdcb7a0d..88583509ddb4 100644 --- a/config/config.mk +++ b/config/config.mk @@ -306,12 +306,10 @@ endif # No opt to give sane callstacks. # ifdef NS_TRACE_MALLOC -_WIN32_TM_FLAGS=-Zi -Od -UDEBUG -DNDEBUG -OS_CFLAGS += $(_WIN32_TM_FLAGS) -OS_CXXFLAGS += $(_WIN32_TM_FLAGS) +MOZ_OPTIMIZE_FLAGS=-Zi -Od -UDEBUG -DNDEBUG OS_LDFLAGS += /DEBUG /DEBUGTYPE:CV /PDB:NONE /OPT:REF /OPT:nowin98 endif -# MOZ_TRACE_MALLOC +# NS_TRACE_MALLOC # if MOZ_DEBUG is not set and MOZ_MAPINFO MAPFILE=$(LIBRARY_NAME).map @@ -561,26 +559,26 @@ ifeq ($(OS_ARCH),WINNT) #//------------------------------------------------------------------------ ifdef USE_STATIC_LIBS RTL_FLAGS=-MT # Statically linked multithreaded RTL -ifneq (,$(MOZ_DEBUG)$(MOZ_TRACE_MALLOC)) +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) RTL_FLAGS=-MTd # Statically linked multithreaded MSVC4.0 debug RTL -endif # MOZ_DEBUG || MOZ_TRACE_MALLOC +endif # MOZ_DEBUG || NS_TRACE_MALLOC else # !USE_STATIC_LIBS ifdef USE_NON_MT_LIBS RTL_FLAGS=-ML # Statically linked non-multithreaded LIBC RTL -ifneq (,$(MOZ_DEBUG)$(MOZ_TRACE_MALLOC)) +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) RTL_FLAGS=-MLd # Statically linked non-multithreaded LIBC debug RTL -endif # MOZ_DEBUG || MOZ_TRACE_MALLOC +endif # MOZ_DEBUG || NS_TRACE_MALLOC else # ! USE_NON_MT_LIBS RTL_FLAGS=-MD # Dynamically linked, multithreaded RTL -ifneq (,$(MOZ_DEBUG)$(MOZ_TRACE_MALLOC)) +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) ifndef MOZ_NO_DEBUG_RTL RTL_FLAGS=-MDd # Dynamically linked, multithreaded MSVC4.0 debug RTL endif -endif # MOZ_DEBUG || MOZ_TRACE_MALLOC +endif # MOZ_DEBUG || NS_TRACE_MALLOC endif # USE_NON_MT_LIBS endif # USE_STATIC_LIBS endif # WINNT diff --git a/tools/trace-malloc/Makefile.in b/tools/trace-malloc/Makefile.in index e7e178e59533..1679006374bb 100644 --- a/tools/trace-malloc/Makefile.in +++ b/tools/trace-malloc/Makefile.in @@ -45,7 +45,7 @@ include $(topsrcdir)/config/config.mk LIBS += \ $(LIBS_DIR) \ tmreader.$(OBJ_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)xpcomds_s.$(LIB_SUFFIX) \ + $(XPCOM_LIBS) \ $(NSPR_LIBS) \ $(NULL) diff --git a/tools/trace-malloc/diffbloatdump.pl b/tools/trace-malloc/diffbloatdump.pl index 4967b0dea72b..9a9098402614 100755 --- a/tools/trace-malloc/diffbloatdump.pl +++ b/tools/trace-malloc/diffbloatdump.pl @@ -85,7 +85,7 @@ sub add_file($$) { my @stack; # read the data at the memory location - while ( ($line = <$infile>) && substr($line,0,1) eq "\t" ) { + while ( defined($infile) && ($line = <$infile>) && substr($line,0,1) eq "\t" ) { # do nothing } @@ -97,7 +97,7 @@ sub add_file($$) { $line = $1; } $stack[$#stack+1] = $line; - } while ( ($line = <$infile>) && $line ne "\n" ); + } while ( defined($infile) && ($line = <$infile>) && $line ne "\n" && $line ne "\r\n" ); return \@stack; } @@ -131,8 +131,8 @@ sub add_file($$) { while ( ! eof(INFILE) ) { # read the type and address my $line = ; - unless ($line =~ /.*\((\d*)\)\n/) { - die "badly formed allocation header"; + unless ($line =~ /.*\((\d*)\)[\r|\n]/) { + die "badly formed allocation header in $infile"; } my $size; if ($::opt_allocation_count) { @@ -146,6 +146,8 @@ sub add_file($$) { close INFILE; } +sub print_node_indent($$$); + sub print_calltree() { sub print_indent($) { my ($i) = @_; diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index dfe8d1e34cab..365a62f1b4b7 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -74,7 +74,10 @@ EXPORTS = \ ifdef NS_TRACE_MALLOC CSRCS += nsTraceMalloc.c -CPPSRCS += nsTypeInfo.cpp +CPPSRCS += nsTypeInfo.cpp +ifeq ($(OS_ARCH),WINNT) +CPPSRCS += nsDebugHelpWin32.cpp nsWinTraceMalloc.cpp +endif EXPORTS += nsTraceMalloc.h DEFINES += -DNS_TRACE_MALLOC endif diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in index 59e9c3ece6fa..edd7225afe06 100644 --- a/xpcom/build/Makefile.in +++ b/xpcom/build/Makefile.in @@ -133,7 +133,7 @@ endif ifeq ($(OS_ARCH),WINNT) DEFINES += -DWIN32_LEAN_AND_MEAN EXTRA_DSO_LDOPTS += shell32.lib ole32.lib -ifneq (,$(MOZ_DEBUG)$(MOZ_TRACE_MALLOC)) +ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) EXTRA_DSO_LDOPTS += imagehlp.lib endif endif # WINNT