diff options
author | Yabin Cui <yabinc@google.com> | 2016-04-13 21:28:54 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-04-14 10:30:16 -0700 |
commit | 040f7b4c62ce49f0af0746640e94d415764262cd (patch) | |
tree | 549f43b79d0639c7a91b78e64c15d797349e517c | |
parent | 6e6aa65411432adee75005558e1bb6056fd9d77a (diff) | |
download | extras-040f7b4c62ce49f0af0746640e94d415764262cd.tar.gz |
simpleperf: use libbacktrace_offline static library.
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
-rw-r--r-- | simpleperf/Android.mk | 46 | ||||
-rw-r--r-- | simpleperf/dwarf_unwind.h | 4 | ||||
-rw-r--r-- | simpleperf/thread_tree.cpp | 4 | ||||
-rw-r--r-- | simpleperf/thread_tree.h | 8 |
4 files changed, 39 insertions, 23 deletions
diff --git a/simpleperf/Android.mk b/simpleperf/Android.mk index 62c37825..ac5ceda8 100644 --- a/simpleperf/Android.mk +++ b/simpleperf/Android.mk @@ -32,13 +32,14 @@ include $(LLVM_ROOT_PATH)/llvm.mk simpleperf_shared_libraries_target := \ libbacktrace \ - libbacktrace_offline \ + libunwind \ libbase \ liblog \ libutils \ libLLVM \ simpleperf_static_libraries_target := \ + libbacktrace_offline \ liblzma \ libziparchive \ libz \ @@ -46,13 +47,13 @@ simpleperf_static_libraries_target := \ static_simpleperf_static_libraries_target := \ libbacktrace_offline \ libbacktrace \ + libunwind \ libziparchive \ libz \ libbase \ libcutils \ liblog \ libutils \ - libunwind \ liblzma \ libLLVMObject \ libLLVMBitReader \ @@ -62,16 +63,6 @@ static_simpleperf_static_libraries_target := \ libLLVMSupport \ libc \ -simpleperf_shared_libraries_host_linux := \ - libbacktrace_offline \ - libbacktrace \ - -simpleperf_shared_libraries_host_darwin := \ - libLLVM \ - -simpleperf_shared_libraries_host_windows := \ - libLLVM \ - simpleperf_static_libraries_host := \ libziparchive-host \ libbase \ @@ -79,6 +70,18 @@ simpleperf_static_libraries_host := \ liblzma \ libz \ libutils \ + libLLVMObject \ + libLLVMBitReader \ + libLLVMMC \ + libLLVMMCParser \ + libLLVMCore \ + libLLVMSupport \ + +simpleperf_static_libraries_host_linux := \ + libbacktrace_offline \ + libbacktrace \ + libunwind \ + libcutils \ simpleperf_ldlibs_host_linux := -lrt @@ -164,9 +167,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_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) @@ -217,11 +218,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) @@ -276,11 +276,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) @@ -309,9 +308,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) @@ -344,7 +344,7 @@ LOCAL_CPPFLAGS := $(simpleperf_cppflags_host) 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) diff --git a/simpleperf/dwarf_unwind.h b/simpleperf/dwarf_unwind.h index c725723e..ba40b879 100644 --- a/simpleperf/dwarf_unwind.h +++ b/simpleperf/dwarf_unwind.h @@ -21,7 +21,11 @@ #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, bool strict_arch_check); diff --git a/simpleperf/thread_tree.cpp b/simpleperf/thread_tree.cpp index 31348749..daf3ff52 100644 --- a/simpleperf/thread_tree.cpp +++ b/simpleperf/thread_tree.cpp @@ -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); diff --git a/simpleperf/thread_tree.h b/simpleperf/thread_tree.h index 3652bbcc..de10138a 100644 --- a/simpleperf/thread_tree.h +++ b/simpleperf/thread_tree.h @@ -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); |