From 43dabd566d38e3ea47d093fa92e2fb44452b8d1c Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Mon, 22 Jan 2018 15:11:07 -0800 Subject: 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 --- simpleperf/OfflineUnwinder.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3