diff options
Diffstat (limited to 'simpleperf')
-rw-r--r-- | simpleperf/OfflineUnwinder.cpp | 8 | ||||
-rw-r--r-- | simpleperf/OfflineUnwinder_test.cpp | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/simpleperf/OfflineUnwinder.cpp b/simpleperf/OfflineUnwinder.cpp index a375a770..b5bd8c0d 100644 --- a/simpleperf/OfflineUnwinder.cpp +++ b/simpleperf/OfflineUnwinder.cpp @@ -142,7 +142,7 @@ unwindstack::Regs* OfflineUnwinderImpl::GetBacktraceRegs(const RegSet& regs) { } } -static unwindstack::MapInfo* CreateMapInfo(const MapEntry* entry) { +static std::shared_ptr<unwindstack::MapInfo> CreateMapInfo(const MapEntry* entry) { std::string name_holder; const char* name = entry->dso->GetDebugFilePath().data(); uint64_t pgoff = entry->pgoff; @@ -165,8 +165,8 @@ static unwindstack::MapInfo* CreateMapInfo(const MapEntry* entry) { name = name_holder.data(); } } - return new unwindstack::MapInfo(nullptr, nullptr, entry->start_addr, entry->get_end_addr(), pgoff, - PROT_READ | entry->flags, name); + return unwindstack::MapInfo::Create(entry->start_addr, entry->get_end_addr(), pgoff, + PROT_READ | entry->flags, name); } void UnwindMaps::UpdateMaps(const MapSet& map_set) { @@ -202,7 +202,7 @@ void UnwindMaps::UpdateMaps(const MapSet& map_set) { if (has_removed_entry) { entries_.resize(std::remove(entries_.begin(), entries_.end(), nullptr) - entries_.begin()); - maps_.resize(std::remove(maps_.begin(), maps_.end(), std::unique_ptr<unwindstack::MapInfo>()) - + maps_.resize(std::remove(maps_.begin(), maps_.end(), std::shared_ptr<unwindstack::MapInfo>()) - maps_.begin()); } diff --git a/simpleperf/OfflineUnwinder_test.cpp b/simpleperf/OfflineUnwinder_test.cpp index 46e74fe0..540cc5d5 100644 --- a/simpleperf/OfflineUnwinder_test.cpp +++ b/simpleperf/OfflineUnwinder_test.cpp @@ -28,9 +28,8 @@ bool CheckUnwindMaps(UnwindMaps& maps, const MapSet& map_set) { if (maps.Total() != map_set.maps.size()) { return false; } - unwindstack::MapInfo* prev_real_map = nullptr; - for (size_t i = 0; i < maps.Total(); i++) { - unwindstack::MapInfo* info = maps.Get(i); + std::shared_ptr<unwindstack::MapInfo> prev_real_map; + for (auto info : maps) { if (info == nullptr || map_set.maps.find(info->start()) == map_set.maps.end()) { return false; } |