Remove troublesome libiberty dependency by using __cxa_demangle instead of cplus_demangle.

Bug #232763 r=dbaron sr=brendan
This commit is contained in:
cls%seawood.org 2004-02-10 16:19:47 +00:00
Родитель 10d0a7ba8c
Коммит 1c32a0ea76
4 изменённых файлов: 714 добавлений и 635 удалений

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

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

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

@ -4354,37 +4354,18 @@ dnl ========================================================
dnl = Support for demangling undefined symbols dnl = Support for demangling undefined symbols
dnl ======================================================== dnl ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_CHECK_LIB(iberty, cplus_demangle, [HAVE_DEMANGLE=1], AC_LANG_SAVE
HAVE_DEMANGLE=, "-liberty") AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
AC_LANG_RESTORE
fi fi
# Demangle only for debug or trace-malloc builds
MOZ_DEMANGLE_SYMBOLS= MOZ_DEMANGLE_SYMBOLS=
if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
if test "$HAVE_DEMANGLE" MOZ_DEMANGLE_SYMBOLS=1
then AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
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 fi
AC_SUBST(MOZ_DEMANGLE_SYMBOLS) AC_SUBST(MOZ_DEMANGLE_SYMBOLS)

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

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

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

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