summaryrefslogtreecommitdiff
path: root/libbacktrace/UnwindStackMap.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-01-30 19:47:24 -0800
committerChristopher Ferris <cferris@google.com>2018-01-31 14:19:42 -0800
commitd70ea5ea8511ae9b9ae57b17390e4027d20e3390 (patch)
tree958dc628f9a4d173076a54bc7d012d85ecc2473e /libbacktrace/UnwindStackMap.cpp
parent01ba1157325a5e6572122f5d46cfd0376b75aa98 (diff)
Move dex pc frame creation into libunwindstack.
Test: Compiles, all unit tests pass. Test: Ran 137-cfi art test in interpreter and verified interpreter Test: frames still show up. Change-Id: Icea90194986faa733a873e8cf467fc2513eb5573
Diffstat (limited to 'libbacktrace/UnwindStackMap.cpp')
-rw-r--r--libbacktrace/UnwindStackMap.cpp32
1 files changed, 3 insertions, 29 deletions
diff --git a/libbacktrace/UnwindStackMap.cpp b/libbacktrace/UnwindStackMap.cpp
index 97f8d782d..1622e30d4 100644
--- a/libbacktrace/UnwindStackMap.cpp
+++ b/libbacktrace/UnwindStackMap.cpp
@@ -26,20 +26,11 @@
#include <unwindstack/MapInfo.h>
#include <unwindstack/Maps.h>
-#include "UnwindDexFile.h"
#include "UnwindStackMap.h"
//-------------------------------------------------------------------------
UnwindStackMap::UnwindStackMap(pid_t pid) : BacktraceMap(pid) {}
-UnwindStackMap::~UnwindStackMap() {
-#ifndef NO_LIBDEXFILE
- for (auto& entry : dex_files_) {
- delete entry.second;
- }
-#endif
-}
-
bool UnwindStackMap::Build() {
if (pid_ == 0) {
pid_ = getpid();
@@ -54,6 +45,9 @@ bool UnwindStackMap::Build() {
// Create a JitDebug object for getting jit unwind information.
std::vector<std::string> search_libs_{"libart.so", "libartd.so"};
jit_debug_.reset(new unwindstack::JitDebug(process_memory_, search_libs_));
+#if !defined(NO_LIBDEXFILE_SUPPORT)
+ dex_files_.reset(new unwindstack::DexFiles(process_memory_));
+#endif
if (!stack_maps_->Parse()) {
return false;
@@ -127,26 +121,6 @@ std::shared_ptr<unwindstack::Memory> UnwindStackMap::GetProcessMemory() {
return process_memory_;
}
-#ifdef NO_LIBDEXFILE
-UnwindDexFile* UnwindStackMap::GetDexFile(uint64_t, unwindstack::MapInfo*) {
- return nullptr;
-}
-#else
-UnwindDexFile* UnwindStackMap::GetDexFile(uint64_t dex_file_offset, unwindstack::MapInfo* info) {
- // Lock while we get the data.
- std::lock_guard<std::mutex> guard(dex_lock_);
- UnwindDexFile* dex_file;
- auto entry = dex_files_.find(dex_file_offset);
- if (entry == dex_files_.end()) {
- dex_file = UnwindDexFile::Create(dex_file_offset, process_memory_.get(), info);
- dex_files_[dex_file_offset] = dex_file;
- } else {
- dex_file = entry->second;
- }
- return dex_file;
-}
-#endif
-
UnwindStackOfflineMap::UnwindStackOfflineMap(pid_t pid) : UnwindStackMap(pid) {}
bool UnwindStackOfflineMap::Build() {