87 lines
2.6 KiB
Diff
87 lines
2.6 KiB
Diff
diff --git a/Makefile.am b/Makefile.am
|
|
index 256c940..593e943 100644
|
|
--- a/Makefile.am
|
|
+++ b/Makefile.am
|
|
@@ -35,6 +35,7 @@ libltrace_la_LIBADD = \
|
|
$(libelf_LIBS) \
|
|
$(liberty_LIBS) \
|
|
$(libsupcxx_LIBS) \
|
|
+ $(libstdcxx_LIBS) \
|
|
$(libunwind_LIBS) \
|
|
$(libunwind_ptrace_LIBS) \
|
|
$(libunwind_arch_LIBS) \
|
|
diff --git a/common.h b/common.h
|
|
index 7fffa76..b84a5d1 100644
|
|
--- a/common.h
|
|
+++ b/common.h
|
|
@@ -16,7 +16,10 @@
|
|
#include "read_config_file.h"
|
|
#include "proc.h"
|
|
|
|
-#if defined HAVE_LIBIBERTY || defined HAVE_LIBSUPC__
|
|
+#if defined HAVE_LIBSUPC__ || defined HAVE_LIBSTDC__
|
|
+# define USE_CXA_DEMANGLE
|
|
+#endif
|
|
+#if defined HAVE_LIBIBERTY || defined USE_CXA_DEMANGLE
|
|
# define USE_DEMANGLE
|
|
#endif
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 707f8c5..1ec7242 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -82,6 +82,14 @@ AC_CHECK_LIB([supc++], [__cxa_demangle], [
|
|
AC_SUBST(libsupcxx_LIBS)
|
|
|
|
|
|
+# HAVE_LIBSTDC__
|
|
+AC_CHECK_LIB([stdc++], [__cxa_demangle], [
|
|
+ AC_DEFINE([HAVE_LIBSTDC__], [1], [we have libstdc++])
|
|
+ libstdcxx_LIBS="-lstdc++"], [
|
|
+ libstdcxx_LIBS=""])
|
|
+AC_SUBST(libstdcxx_LIBS)
|
|
+
|
|
+
|
|
dnl Check security_get_boolean_active availability.
|
|
AC_CHECK_HEADERS(selinux/selinux.h)
|
|
AC_CHECK_LIB(selinux, security_get_boolean_active)
|
|
diff --git a/demangle.c b/demangle.c
|
|
index 5825e28..26a5c7a 100644
|
|
--- a/demangle.c
|
|
+++ b/demangle.c
|
|
@@ -15,9 +15,8 @@ static Dict *d = NULL;
|
|
const char *
|
|
my_demangle(const char *function_name) {
|
|
const char *tmp, *fn_copy;
|
|
-#if !defined HAVE_LIBIBERTY && defined HAVE_LIBSUPC__
|
|
+#ifdef USE_CXA_DEMANGLE
|
|
extern char *__cxa_demangle(const char *, char *, size_t *, int *);
|
|
- int status = 0;
|
|
#endif
|
|
|
|
debug(DEBUG_FUNCTION, "my_demangle(name=%s)", function_name);
|
|
@@ -30,7 +29,8 @@ my_demangle(const char *function_name) {
|
|
fn_copy = strdup(function_name);
|
|
#ifdef HAVE_LIBIBERTY
|
|
tmp = cplus_demangle(function_name, DMGL_ANSI | DMGL_PARAMS);
|
|
-#elif defined HAVE_LIBSUPC__
|
|
+#elif defined USE_CXA_DEMANGLE
|
|
+ int status = 0;
|
|
tmp = __cxa_demangle(function_name, NULL, NULL, &status);
|
|
#endif
|
|
if (!tmp)
|
|
diff --git a/testsuite/ltrace.minor/demangle.exp b/testsuite/ltrace.minor/demangle.exp
|
|
index c2d3aeb..9dd7694 100644
|
|
--- a/testsuite/ltrace.minor/demangle.exp
|
|
+++ b/testsuite/ltrace.minor/demangle.exp
|
|
@@ -32,6 +32,9 @@ if [regexp {ELF from incompatible architecture} $exec_output] {
|
|
} elseif [ regexp {Couldn't get .hash data} $exec_output ] {
|
|
fail "Couldn't get .hash data!"
|
|
return
|
|
+} elseif [ regexp {invalid option} $exec_output ] {
|
|
+ unsupported "Demangle support not compiled in."
|
|
+ return
|
|
}
|
|
|
|
# read function declarations from demangle.cpp and verify them in demangle.ltrace.
|