diff options
author | Christopher Ferris <cferris@google.com> | 2014-01-10 00:43:54 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2014-01-13 23:57:35 -0800 |
commit | f67c6410d12a1829b0c6d009c848d72cd0158ee4 (patch) | |
tree | 7d688be1b855ece23b6fe4ff2dbc8aee3fe6d88f | |
parent | 688701990db1aef2d7dbe0ccdc4f12c2dd5f51a8 (diff) | |
download | system_core-f67c6410d12a1829b0c6d009c848d72cd0158ee4.zip system_core-f67c6410d12a1829b0c6d009c848d72cd0158ee4.tar.gz system_core-f67c6410d12a1829b0c6d009c848d72cd0158ee4.tar.bz2 |
Create a bare bones host libbacktrace on mac.
This allows the libbacktrace library to compile for host on mac.
Bug: 12474939
Change-Id: I32cbcf996e6fe9057e5065ba21f89086343704a0
-rw-r--r-- | libbacktrace/Android.mk | 47 | ||||
-rw-r--r-- | libbacktrace/Backtrace.cpp | 2 | ||||
-rw-r--r-- | libbacktrace/BacktraceThread.h | 1 |
3 files changed, 34 insertions, 16 deletions
diff --git a/libbacktrace/Android.mk b/libbacktrace/Android.mk index a6b9c2b..8995fc1 100644 --- a/libbacktrace/Android.mk +++ b/libbacktrace/Android.mk @@ -168,18 +168,15 @@ LOCAL_ADDITIONAL_DEPENDENCIES := \ include $(BUILD_NATIVE_TEST) #---------------------------------------------------------------------------- -# Only linux-x86 host versions of libbacktrace supported. +# Only x86 host versions of libbacktrace supported. #---------------------------------------------------------------------------- -ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) +ifeq ($(HOST_ARCH),x86) #---------------------------------------------------------------------------- # The host libbacktrace library using libcorkscrew #---------------------------------------------------------------------------- include $(CLEAR_VARS) -LOCAL_SRC_FILES += \ - $(common_src) \ - Corkscrew.cpp \ LOCAL_CFLAGS += \ $(common_cflags) \ @@ -187,31 +184,51 @@ LOCAL_CFLAGS += \ LOCAL_CONLYFLAGS += \ $(common_conlyflags) \ -LOCAL_CPPFLAGS += \ - $(common_cppflags) \ - LOCAL_C_INCLUDES := \ $(common_c_includes) \ - system/core/libcorkscrew \ LOCAL_SHARED_LIBRARIES := \ libgccdemangle \ liblog \ + +LOCAL_MODULE := libbacktrace +LOCAL_MODULE_TAGS := optional + +LOCAL_ADDITIONAL_DEPENDENCIES := \ + $(LOCAL_PATH)/Android.mk + +ifeq ($(HOST_OS),linux) +LOCAL_SRC_FILES += \ + $(common_src) \ + Corkscrew.cpp \ + +LOCAL_C_INCLUDES += \ + system/core/libcorkscrew \ + +LOCAL_SHARED_LIBRARIES := \ libcorkscrew \ +LOCAL_CPPFLAGS += \ + $(common_cppflags) \ + LOCAL_LDLIBS += \ -ldl \ -lrt \ -LOCAL_MODULE := libbacktrace -LOCAL_MODULE_TAGS := optional +else +LOCAL_SRC_FILES += \ + map_info.c \ -LOCAL_ADDITIONAL_DEPENDENCIES := \ - $(LOCAL_PATH)/Android.mk +endif include $(BUILD_HOST_SHARED_LIBRARY) #---------------------------------------------------------------------------- +# The host test is only supported on linux. +#---------------------------------------------------------------------------- +ifeq ($(HOST_OS),linux) + +#---------------------------------------------------------------------------- # libbacktrace host test library, all optimizations turned off #---------------------------------------------------------------------------- include $(CLEAR_VARS) @@ -263,4 +280,6 @@ LOCAL_ADDITIONAL_DEPENDENCIES := \ include $(BUILD_HOST_NATIVE_TEST) -endif # HOST_OS-HOST_ARCH == linux-x86 +endif # HOST_OS == linux + +endif # HOST_ARCH == x86 diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp index fa85872..20667e0 100644 --- a/libbacktrace/Backtrace.cpp +++ b/libbacktrace/Backtrace.cpp @@ -87,7 +87,7 @@ std::string Backtrace::GetFunctionName(uintptr_t pc, uintptr_t* offset) { if (!func_name.empty()) { #if defined(__APPLE__) // Mac OS' __cxa_demangle demangles "f" as "float"; last tested on 10.7. - if (symbol_name[0] != '_') { + if (func_name[0] != '_') { return func_name; } #endif diff --git a/libbacktrace/BacktraceThread.h b/libbacktrace/BacktraceThread.h index bcb56c9..a4b6ecb 100644 --- a/libbacktrace/BacktraceThread.h +++ b/libbacktrace/BacktraceThread.h @@ -18,7 +18,6 @@ #define _LIBBACKTRACE_BACKTRACE_THREAD_H #include <inttypes.h> -#include <pthread.h> #include <sys/types.h> #include "Backtrace.h" |