OSDN Git Service

simpleperf: use libbacktrace_offline static library.
authorYabin Cui <yabinc@google.com>
Thu, 14 Apr 2016 04:28:54 +0000 (21:28 -0700)
committerYabin Cui <yabinc@google.com>
Thu, 14 Apr 2016 22:06:25 +0000 (15:06 -0700)
Device may not have libbacktrace_offline shared library, so always
using libbacktrace_offline static library.
Use simpleperf namespace to avoid conflicts with ThreadEntry in
libbacktrace.

Bug: 28152982
Change-Id: Ia2cdbee3b28556c790ccd7b061a801ed96f9b97c
(cherry picked from commit 040f7b4c62ce49f0af0746640e94d415764262cd)

simpleperf/Android.mk
simpleperf/dwarf_unwind.h
simpleperf/thread_tree.cpp
simpleperf/thread_tree.h

index add39ab..9eb4be8 100644 (file)
@@ -32,22 +32,17 @@ include $(LLVM_ROOT_PATH)/llvm.mk
 
 simpleperf_shared_libraries_target := \
   libbacktrace \
-  libbacktrace_offline \
+  libunwind \
   libbase \
   liblog \
   libutils \
   libLLVM \
 
 simpleperf_static_libraries_target := \
-  libziparchive \
-
-simpleperf_shared_libraries_host_linux := \
-  libbacktrace \
   libbacktrace_offline \
-
-simpleperf_shared_libraries_host_darwin := libLLVM
-
-simpleperf_shared_libraries_host_windows := libLLVM
+  liblzma \
+  libziparchive \
+  libz \
 
 simpleperf_static_libraries_host := \
   libziparchive-host \
@@ -55,6 +50,19 @@ simpleperf_static_libraries_host := \
   liblog \
   libz \
   libutils \
+  libLLVMObject \
+  libLLVMBitReader \
+  libLLVMMC \
+  libLLVMMCParser \
+  libLLVMCore \
+  libLLVMSupport \
+
+simpleperf_static_libraries_host_linux := \
+  libbacktrace_offline \
+  libbacktrace \
+  libunwind \
+  libcutils \
+  liblzma \
 
 simpleperf_ldlibs_host_linux := -lrt
 
@@ -126,10 +134,7 @@ LOCAL_SRC_FILES_darwin := $(libsimpleperf_src_files_darwin)
 LOCAL_SRC_FILES_linux := $(libsimpleperf_src_files_linux)
 LOCAL_SRC_FILES_windows := $(libsimpleperf_src_files_windows)
 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
-LOCAL_SHARED_LIBRARIES := $(simpleperf_shared_libraries_host)
-LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
-LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
-LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
+LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
 LOCAL_MULTILIB := first
 include $(LLVM_HOST_BUILD_MK)
@@ -162,11 +167,10 @@ LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
 LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
 LOCAL_SRC_FILES := main.cpp
 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
-LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
-LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
-LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
+LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
 LOCAL_MULTILIB := first
+include $(LLVM_HOST_BUILD_MK)
 include $(BUILD_HOST_EXECUTABLE)
 
 
@@ -215,11 +219,10 @@ LOCAL_CPPFLAGS_windows := $(simpleperf_cppflags_host_windows)
 LOCAL_SRC_FILES := $(simpleperf_unit_test_src_files)
 LOCAL_SRC_FILES_linux := $(simpleperf_unit_test_src_files_linux)
 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
-LOCAL_SHARED_LIBRARIES_darwin := $(simpleperf_shared_libraries_host_darwin)
-LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
-LOCAL_SHARED_LIBRARIES_windows := $(simpleperf_shared_libraries_host_windows)
+LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
 LOCAL_MULTILIB := first
+include $(LLVM_HOST_BUILD_MK)
 include $(BUILD_HOST_NATIVE_TEST)
 
 
@@ -248,9 +251,10 @@ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host)
 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
 LOCAL_SRC_FILES := $(simpleperf_cpu_hotplug_test_src_files)
 LOCAL_STATIC_LIBRARIES := libsimpleperf $(simpleperf_static_libraries_host)
-LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
+LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
 LOCAL_MULTILIB := first
+include $(LLVM_HOST_BUILD_MK)
 include $(BUILD_HOST_NATIVE_TEST)
 
 
@@ -283,7 +287,7 @@ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) -DIN_CTS_TEST
 LOCAL_CPPFLAGS_linux := $(simpleperf_cppflags_host_linux)
 LOCAL_SRC_FILES := $(libsimpleperf_cts_test_src_files)
 LOCAL_STATIC_LIBRARIES := $(simpleperf_static_libraries_host)
-LOCAL_SHARED_LIBRARIES_linux := $(simpleperf_shared_libraries_host_linux)
+LOCAL_STATIC_LIBRARIES_linux := $(simpleperf_static_libraries_host_linux)
 LOCAL_LDLIBS_linux := $(simpleperf_ldlibs_host_linux)
 LOCAL_MULTILIB := both
 include $(LLVM_HOST_BUILD_MK)
index 4e3ffd1..6982b05 100644 (file)
 
 #include "perf_regs.h"
 
+namespace simpleperf {
 struct ThreadEntry;
+}
+
+using ThreadEntry = simpleperf::ThreadEntry;
 
 std::vector<uint64_t> UnwindCallChain(ArchType arch, const ThreadEntry& thread, const RegSet& regs,
                                       const std::vector<char>& stack);
index 3134874..daf3ff5 100644 (file)
@@ -24,6 +24,8 @@
 #include "perf_event.h"
 #include "record.h"
 
+namespace simpleperf {
+
 bool MapComparator::operator()(const MapEntry* map1, const MapEntry* map2) const {
   if (map1->start_addr != map2->start_addr) {
     return map1->start_addr < map2->start_addr;
@@ -207,6 +209,8 @@ void ThreadTree::Clear() {
   user_dso_tree_.clear();
 }
 
+}  // namespace simpleperf
+
 void BuildThreadTree(const Record& record, ThreadTree* thread_tree) {
   if (record.header.type == PERF_RECORD_MMAP) {
     const MmapRecord& r = *static_cast<const MmapRecord*>(&record);
index 3652bbc..de10138 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "dso.h"
 
+namespace simpleperf {
+
 struct MapEntry {
   uint64_t start_addr;
   uint64_t len;
@@ -97,6 +99,12 @@ class ThreadTree {
   Symbol unknown_symbol_;
 };
 
+}  // namespace simpleperf
+
+using MapEntry = simpleperf::MapEntry;
+using ThreadEntry = simpleperf::ThreadEntry;
+using ThreadTree = simpleperf::ThreadTree;
+
 struct Record;
 
 void BuildThreadTree(const Record& record, ThreadTree* thread_tree);