diff options
author | Yabin Cui <yabinc@google.com> | 2018-01-22 15:11:07 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2018-01-22 15:11:07 -0800 |
commit | 43dabd566d38e3ea47d093fa92e2fb44452b8d1c (patch) | |
tree | 0e9a56a1cc4cbfc9c440be9b72d4919327609fcd | |
parent | 3cd1778cdfbf7b7b49de86cdcded0a07e46b54c3 (diff) | |
download | extras-43dabd566d38e3ea47d093fa92e2fb44452b8d1c.tar.gz |
simpleperf: fix test record_cmd.post_unwind_option.
Sometimes a sample hits a pc location with no map, and results in
empty ips vector. This makes test record_cmd.post_unwind_option fail.
Bug: none
Test: run CtsSimpleperfTestCases.
Change-Id: If9ced5ee36fc6967afd2e82a11440d7410a74ea7
-rw-r--r-- | simpleperf/OfflineUnwinder.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/simpleperf/OfflineUnwinder.cpp b/simpleperf/OfflineUnwinder.cpp index f06103b6..53cf4512 100644 --- a/simpleperf/OfflineUnwinder.cpp +++ b/simpleperf/OfflineUnwinder.cpp @@ -165,7 +165,13 @@ bool OfflineUnwinder::UnwindCallChain(int abi, const ThreadEntry& thread, const } } if (ips->empty()) { - return false; + uint64_t ip_reg_value; + if (!GetIpRegValue(regs, arch, &ip_reg_value)) { + LOG(ERROR) << "can't get ip reg value"; + return false; + } + ips->push_back(ip_reg_value); + sps->push_back(sp_reg_value); } if (collect_stat_) { unwinding_result_.used_time = GetSystemClock() - start_time; |