diff options
author | Yabin Cui <yabinc@google.com> | 2018-03-07 15:55:48 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-03-07 15:55:48 -0800 |
commit | 31f21a282356c1a5aca5109abe3db1d68f5c880d (patch) | |
tree | b641ac3d8de5c37d16d79c93ea288916520b5e53 /simpleperf | |
parent | 0b922984847bda4c0e00f07dc404664909a1fcc0 (diff) | |
download | extras-31f21a282356c1a5aca5109abe3db1d68f5c880d.tar.gz |
simpleperf: Fix cached map in OfflineUnwinder.
In system wide profiling, sometimes a sample record goes before all
mmap records of a process. Then thread.maps->version = 0 and
cached_map.map isn't created.
This is caught by simpleperf_unit_test.
Bug: none
Test: run simpleperf_unit_test.
Change-Id: I99254396d0fb22531f735ff3193b8d3b1f9641dd
Diffstat (limited to 'simpleperf')
-rw-r--r-- | simpleperf/OfflineUnwinder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/simpleperf/OfflineUnwinder.cpp b/simpleperf/OfflineUnwinder.cpp index ae33cafd..9d561447 100644 --- a/simpleperf/OfflineUnwinder.cpp +++ b/simpleperf/OfflineUnwinder.cpp @@ -131,7 +131,7 @@ bool OfflineUnwinder::UnwindCallChain(const ThreadEntry& thread, const RegSet& r auto map_it = cached_maps_.find(thread.pid); CachedMap& cached_map = (map_it == cached_maps_.end() ? cached_maps_[thread.pid] : map_it->second); - if (cached_map.version < thread.maps->version) { + if (!cached_map.map || cached_map.version < thread.maps->version) { std::vector<backtrace_map_t> bt_maps(thread.maps->maps.size()); size_t map_index = 0; for (auto& map : thread.maps->maps) { |