Missed a cplus_demangle call and it turns out that all of trace-malloc needs to be tweaked to use c++ instead of C.
Bug #232763
This commit is contained in:
cls%seawood.org 2004-02-10 18:55:04 +00:00
Родитель e6e9f61a77
Коммит bc24ffd464
8 изменённых файлов: 764 добавлений и 602 удалений

Просмотреть файл

@ -635,6 +635,11 @@ MOZ_COMPONENT_XPCOM_LIBS += -lboehm
XPCOM_LIBS += -lboehm
endif
ifdef MOZ_DEMANGLE_SYMBOLS
MOZ_COMPONENT_XPCOM_LIBS += -liberty
XPCOM_LIBS += -liberty
endif
ifeq (xpconnect, $(findstring xpconnect, $(BUILD_MODULES)))
DEFINES += -DXPCONNECT_STANDALONE
endif

1263
configure поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -4354,18 +4354,37 @@ dnl ========================================================
dnl = Support for demangling undefined symbols
dnl ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
AC_LANG_RESTORE
AC_CHECK_LIB(iberty, cplus_demangle, [HAVE_DEMANGLE=1],
HAVE_DEMANGLE=, "-liberty")
fi
# Demangle only for debug or trace-malloc builds
MOZ_DEMANGLE_SYMBOLS=
if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
MOZ_DEMANGLE_SYMBOLS=1
AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
if test "$HAVE_DEMANGLE"
then
case "$target" in
*-linux*)
# Demangle only for debug or trace-malloc builds
if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"
then
MOZ_DEMANGLE_SYMBOLS=1
AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
fi
;;
*-solaris*)
# Demangle only for debug builds which are using the Gnu compiler.
if test "$GNU_CC"
then
if test "$MOZ_DEBUG"
then
MOZ_DEMANGLE_SYMBOLS=1
AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
fi
fi
;;
esac
fi
AC_SUBST(MOZ_DEMANGLE_SYMBOLS)

Просмотреть файл

@ -45,6 +45,10 @@ EXPORTS = nsTraceMalloc.h
EXTRA_DSO_LDOPTS = $(NSPR_LIBS)
ifdef MOZ_DEMANGLE_SYMBOLS
EXTRA_DSO_LDOPTS += -liberty
endif
ifeq ($(OS_ARCH),WINNT)
CPPSRCS += nsDebugHelpWin32.cpp nsWinTraceMalloc.cpp nsStackFrameWin.cpp
EXTRA_DSO_LDOPTS += $(XPCOM_LIBS)

Просмотреть файл

@ -52,13 +52,14 @@
// This thing is exported by libstdc++
// This thing is exported by libiberty.a (-liberty)
// Yes, this is a gcc only hack
#if defined(MOZ_DEMANGLE_SYMBOLS)
#include <cxxabi.h>
extern "C" char * cplus_demangle(const char *,int);
#include <stdlib.h> // for free()
#endif // MOZ_DEMANGLE_SYMBOLS
#if (defined(__linux__) || defined(__sun)) && defined(__GNUC__)
void DemangleSymbol(const char * aSymbol,
char * aBuffer,
int aBufLen)
@ -66,13 +67,10 @@ void DemangleSymbol(const char * aSymbol,
aBuffer[0] = '\0';
#if defined(MOZ_DEMANGLE_SYMBOLS)
char outBuffer[4096];
size_t outBufLen = sizeof(outBuffer);
int status;
/* See demangle.h in the gcc source for the voodoo */
char * demangled = abi::__cxa_demangle(aSymbol,outBuffer,&outBufLen,&status);
char * demangled = cplus_demangle(aSymbol,3);
if (demangled && !status)
if (demangled)
{
strncpy(aBuffer,demangled,aBufLen);
free(demangled);
@ -80,6 +78,17 @@ void DemangleSymbol(const char * aSymbol,
#endif // MOZ_DEMANGLE_SYMBOLS
}
#else
void DemangleSymbol(const char * aSymbol,
char * aBuffer,
int aBufLen)
{
// lose
aBuffer[0] = '\0';
}
#endif
#if defined(linux) && defined(__GLIBC__) && (defined(__i386) || defined(PPC)) // i386 or PPC Linux stackwalking code

Просмотреть файл

@ -970,13 +970,15 @@ nsTraceRefcntImpl::WalkTheStack(FILE* aStream)
//----------------------------------------------------------------------
// This thing is exported by libstdc++
// This thing is exported by libiberty.a (-liberty)
// Yes, this is a gcc only hack
#if defined(MOZ_DEMANGLE_SYMBOLS)
#include <cxxabi.h>
extern "C" char * cplus_demangle(const char *,int);
#include <stdlib.h> // for free()
#endif // MOZ_DEMANGLE_SYMBOLS
#if (defined(__linux__) || defined(__sun)) && defined(__GNUC__)
NS_COM void
nsTraceRefcntImpl::DemangleSymbol(const char * aSymbol,
char * aBuffer,
@ -989,20 +991,32 @@ nsTraceRefcntImpl::DemangleSymbol(const char * aSymbol,
aBuffer[0] = '\0';
#if defined(MOZ_DEMANGLE_SYMBOLS)
char outBuffer[4096];
size_t outBufLen = sizeof(outBuffer);
int status;
/* See demangle.h in the gcc source for the voodoo */
char * demangled = abi::__cxa_demangle(aSymbol,outBuffer,&outBufLen,&status);
char * demangled = cplus_demangle(aSymbol,3);
if (demangled && !status)
if (demangled)
{
strncpy(aBuffer,demangled,aBufLen);
free(demangled);
}
#endif // MOZ_DEMANGLE_SYMBOLS
}
#else // ( __linux__ || __sun) && __GNUC__
NS_COM void
nsTraceRefcntImpl::DemangleSymbol(const char * aSymbol,
char * aBuffer,
int aBufLen)
{
NS_ASSERTION(nsnull != aSymbol,"null symbol");
NS_ASSERTION(nsnull != aBuffer,"null buffer");
// lose
aBuffer[0] = '\0';
}
#endif // (__linux__ || __sun) && __GNUC__
//----------------------------------------------------------------------

Просмотреть файл

@ -101,6 +101,10 @@ SDK_HEADERS = \
SDK_BINARY = $(IMPORT_LIBRARY) $(SHARED_LIBRARY)
ifdef MOZ_DEMANGLE_SYMBOLS
EXTRA_DSO_LDOPTS += -liberty
endif
# pull in MoreFiles for MacOSX
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
EXTRA_DSO_LIBS = macmorefiles_s

Просмотреть файл

@ -180,6 +180,10 @@ ifdef GC_LEAK_DETECTOR
LIBS += -lboehm
endif
ifdef MOZ_DEMANGLE_SYMBOLS
LIBS += -liberty
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
CPPSRCS += nsNativeAppSupportBeOS.cpp