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 ========================================================
if test -z "$SKIP_LIBRARY_CHECKS"; then
AC_CHECK_LIB(iberty, cplus_demangle, [HAVE_DEMANGLE=1],
HAVE_DEMANGLE=, "-liberty")
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
AC_LANG_RESTORE
fi
# Demangle only for debug or trace-malloc builds
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
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)
fi
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
#if defined(MOZ_DEMANGLE_SYMBOLS)
extern "C" char * cplus_demangle(const char *,int);
#include <cxxabi.h>
#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)
@ -67,10 +66,13 @@ 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 = cplus_demangle(aSymbol,3);
char * demangled = abi::__cxa_demangle(aSymbol,outBuffer,&outBufLen,&status);
if (demangled)
if (demangled && !status)
{
strncpy(aBuffer,demangled,aBufLen);
free(demangled);
@ -78,17 +80,6 @@ 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,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
#if defined(MOZ_DEMANGLE_SYMBOLS)
extern "C" char * cplus_demangle(const char *,int);
#include <cxxabi.h>
#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,
@ -991,32 +989,20 @@ 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 = cplus_demangle(aSymbol,3);
char * demangled = abi::__cxa_demangle(aSymbol,outBuffer,&outBufLen,&status);
if (demangled)
if (demangled && !status)
{
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__
//----------------------------------------------------------------------