Merge "Link with libgccdemangle.so for name demangling."

This commit is contained in:
Jing Yu 2011-11-10 13:45:28 -08:00 committed by Android (Google) Code Review
commit 6009842389
2 changed files with 6 additions and 12 deletions

View file

@ -28,8 +28,7 @@ ifeq ($(TARGET_ARCH),arm)
LOCAL_SRC_FILES += \
arch-arm/backtrace-arm.c \
arch-arm/ptrace-arm.c
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH -DCORKSCREW_HAVE_LIBIBERTY
LOCAL_LDFLAGS += -liberty
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_SRC_FILES += \
@ -38,7 +37,7 @@ LOCAL_SRC_FILES += \
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
endif
LOCAL_SHARED_LIBRARIES += libdl libcutils
LOCAL_SHARED_LIBRARIES += libdl libcutils libgccdemangle
LOCAL_CFLAGS += -std=gnu99 -Werror
LOCAL_MODULE := libcorkscrew

View file

@ -21,15 +21,10 @@
#include <cutils/log.h>
#ifdef CORKSCREW_HAVE_LIBIBERTY
// Defined in libiberty.a
extern char *cplus_demangle(const char *mangled, int options);
#endif
extern char *__cxa_demangle (const char *mangled, char *buf, size_t *len,
int *status);
char* demangle_symbol_name(const char* name) {
#ifdef CORKSCREW_HAVE_LIBIBERTY
return name ? cplus_demangle(name, 0) : NULL;
#else
return NULL;
#endif
// __cxa_demangle handles NULL by returning NULL
return __cxa_demangle(name, 0, 0, 0);
}