summaryrefslogtreecommitdiffstats
path: root/libunwindstack/DexFiles.cpp
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2018-11-15 18:08:06 +0000
committerMartin Stjernholm <mast@google.com>2018-12-13 17:58:23 +0000
commit444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b (patch)
tree259892bf4c90f2281bc7883352ff89f0ed4b148e /libunwindstack/DexFiles.cpp
parent8f3ed624226941740ee0a818096dbda095badae8 (diff)
downloadsystem_core-444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b.tar.gz
system_core-444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b.tar.bz2
system_core-444e23d2fc6d7c6f799ff9e2f69c1a82d2960c5b.zip
Use libdexfile external API in libunwindstack.
Test: mmma system/core/{libunwindstack,libbacktrace}, run host gtests Test: Make image, flash, and reboot device. Bug: 119632407 Change-Id: I370f089a1b20ba432e136818b4325d46f99df708
Diffstat (limited to 'libunwindstack/DexFiles.cpp')
-rw-r--r--libunwindstack/DexFiles.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/libunwindstack/DexFiles.cpp b/libunwindstack/DexFiles.cpp
index 451a0b90d..63a77e50f 100644
--- a/libunwindstack/DexFiles.cpp
+++ b/libunwindstack/DexFiles.cpp
@@ -48,11 +48,7 @@ DexFiles::DexFiles(std::shared_ptr<Memory>& memory) : Global(memory) {}
DexFiles::DexFiles(std::shared_ptr<Memory>& memory, std::vector<std::string>& search_libs)
: Global(memory, search_libs) {}
-DexFiles::~DexFiles() {
- for (auto& entry : files_) {
- delete entry.second;
- }
-}
+DexFiles::~DexFiles() {}
void DexFiles::ProcessArch() {
switch (arch()) {
@@ -137,10 +133,11 @@ DexFile* DexFiles::GetDexFile(uint64_t dex_file_offset, MapInfo* info) {
DexFile* dex_file;
auto entry = files_.find(dex_file_offset);
if (entry == files_.end()) {
- dex_file = DexFile::Create(dex_file_offset, memory_.get(), info);
- files_[dex_file_offset] = dex_file;
+ std::unique_ptr<DexFile> new_dex_file = DexFile::Create(dex_file_offset, memory_.get(), info);
+ dex_file = new_dex_file.get();
+ files_[dex_file_offset] = std::move(new_dex_file);
} else {
- dex_file = entry->second;
+ dex_file = entry->second.get();
}
return dex_file;
}