blob: c747eabc66f53e84ed656dc7f24914baed83574c [file] [log] [blame]
Christopher Ferris2a25c4a2017-07-07 16:35:48 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <errno.h>
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070018#include <signal.h>
19#include <stdint.h>
Christopher Ferrisedccd842017-09-06 14:15:28 -070020#include <string.h>
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070021#include <sys/ptrace.h>
22#include <sys/syscall.h>
23#include <unistd.h>
24
25#include <gtest/gtest.h>
26
27#include <atomic>
28#include <memory>
29#include <sstream>
30#include <string>
31#include <thread>
Christopher Ferrisa0196652017-07-18 16:09:20 -070032#include <vector>
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070033
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070034#include <android-base/stringprintf.h>
Elliott Hughes38488902018-07-11 11:13:16 -070035#include <android-base/threads.h>
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070036
Christopher Ferrisd226a512017-07-14 10:37:19 -070037#include <unwindstack/Maps.h>
38#include <unwindstack/Memory.h>
39#include <unwindstack/Regs.h>
40#include <unwindstack/RegsGetLocal.h>
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070041#include <unwindstack/Unwinder.h>
Christopher Ferrisd226a512017-07-14 10:37:19 -070042
Christopher Ferrisedccd842017-09-06 14:15:28 -070043#include "TestUtils.h"
44
Christopher Ferrisd226a512017-07-14 10:37:19 -070045namespace unwindstack {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070046
Christopher Ferriseb0772f2018-12-05 15:57:02 -080047enum TestTypeEnum : uint8_t {
48 TEST_TYPE_LOCAL_UNWINDER = 0,
49 TEST_TYPE_LOCAL_UNWINDER_FROM_PID,
Christopher Ferrisbc6a7e52019-01-18 16:33:27 -080050 TEST_TYPE_LOCAL_WAIT_FOR_FINISH,
Christopher Ferriseb0772f2018-12-05 15:57:02 -080051 TEST_TYPE_REMOTE,
52 TEST_TYPE_REMOTE_WITH_INVALID_CALL,
53};
54
Christopher Ferrisedccd842017-09-06 14:15:28 -070055static std::atomic_bool g_ready;
56static volatile bool g_ready_for_remote;
57static volatile bool g_signal_ready_for_remote;
58static std::atomic_bool g_finish;
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070059static std::atomic_uintptr_t g_ucontext;
60
Christopher Ferrisedccd842017-09-06 14:15:28 -070061static void ResetGlobals() {
62 g_ready = false;
63 g_ready_for_remote = false;
64 g_signal_ready_for_remote = false;
65 g_finish = false;
66 g_ucontext = 0;
67}
68
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070069static std::vector<const char*> kFunctionOrder{"OuterFunction", "MiddleFunction", "InnerFunction"};
Christopher Ferrisa0196652017-07-18 16:09:20 -070070
Christopher Ferrisb9de87f2017-09-20 13:37:24 -070071static std::vector<const char*> kFunctionSignalOrder{"OuterFunction", "MiddleFunction",
72 "InnerFunction", "SignalOuterFunction",
73 "SignalMiddleFunction", "SignalInnerFunction"};
Christopher Ferrisa0196652017-07-18 16:09:20 -070074
75static void SignalHandler(int, siginfo_t*, void* sigcontext) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -070076 g_ucontext = reinterpret_cast<uintptr_t>(sigcontext);
77 while (!g_finish.load()) {
78 }
79}
80
Christopher Ferrisa0196652017-07-18 16:09:20 -070081extern "C" void SignalInnerFunction() {
82 g_signal_ready_for_remote = true;
Christopher Ferrisbc6a7e52019-01-18 16:33:27 -080083 // Avoid any function calls because not every instruction will be
84 // unwindable.
85 // This method of looping is only used when testing a remote unwind.
86 while (true) {
Christopher Ferrisa0196652017-07-18 16:09:20 -070087 }
88}
89
90extern "C" void SignalMiddleFunction() {
91 SignalInnerFunction();
92}
93
94extern "C" void SignalOuterFunction() {
95 SignalMiddleFunction();
96}
97
98static void SignalCallerHandler(int, siginfo_t*, void*) {
99 SignalOuterFunction();
100}
101
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800102static std::string ErrorMsg(const std::vector<const char*>& function_names, Unwinder* unwinder) {
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700103 std::string unwind;
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800104 for (size_t i = 0; i < unwinder->NumFrames(); i++) {
105 unwind += unwinder->FormatFrame(i) + '\n';
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700106 }
107
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700108 return std::string(
109 "Unwind completed without finding all frames\n"
110 " Looking for function: ") +
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700111 function_names.front() + "\n" + "Unwind data:\n" + unwind;
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700112}
113
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800114static void VerifyUnwind(Unwinder* unwinder, std::vector<const char*> expected_function_names) {
115 unwinder->Unwind();
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700116
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800117 for (auto& frame : unwinder->frames()) {
Christopher Ferrisca9a54b2018-04-05 11:15:00 -0700118 if (frame.function_name == expected_function_names.back()) {
119 expected_function_names.pop_back();
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700120 if (expected_function_names.empty()) {
121 break;
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700122 }
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700123 }
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700124 }
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700125
126 ASSERT_TRUE(expected_function_names.empty()) << ErrorMsg(expected_function_names, unwinder);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700127}
128
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800129static void VerifyUnwind(pid_t pid, Maps* maps, Regs* regs,
130 std::vector<const char*> expected_function_names) {
131 auto process_memory(Memory::CreateProcessMemory(pid));
132
133 Unwinder unwinder(512, maps, regs, process_memory);
134 VerifyUnwind(&unwinder, expected_function_names);
135}
136
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700137// This test assumes that this code is compiled with optimizations turned
138// off. If this doesn't happen, then all of the calls will be optimized
139// away.
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800140extern "C" void InnerFunction(TestTypeEnum test_type) {
Christopher Ferrisbc6a7e52019-01-18 16:33:27 -0800141 if (test_type == TEST_TYPE_LOCAL_WAIT_FOR_FINISH) {
142 while (!g_finish.load()) {
143 }
144 return;
145 }
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800146 if (test_type == TEST_TYPE_REMOTE || test_type == TEST_TYPE_REMOTE_WITH_INVALID_CALL) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700147 g_ready_for_remote = true;
148 g_ready = true;
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800149 if (test_type == TEST_TYPE_REMOTE_WITH_INVALID_CALL) {
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700150 void (*crash_func)() = nullptr;
151 crash_func();
152 }
Christopher Ferrisbc6a7e52019-01-18 16:33:27 -0800153 // Avoid any function calls because not every instruction will be
154 // unwindable.
155 // This method of looping is only used when testing a remote unwind.
156 while (true) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700157 }
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800158 return;
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700159 }
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800160
161 std::unique_ptr<Unwinder> unwinder;
162 std::unique_ptr<Regs> regs(Regs::CreateFromLocal());
163 RegsGetLocal(regs.get());
164 std::unique_ptr<Maps> maps;
165
166 if (test_type == TEST_TYPE_LOCAL_UNWINDER) {
167 maps.reset(new LocalMaps());
168 ASSERT_TRUE(maps->Parse());
169 auto process_memory(Memory::CreateProcessMemory(getpid()));
170 unwinder.reset(new Unwinder(512, maps.get(), regs.get(), process_memory));
171 } else {
172 UnwinderFromPid* unwinder_from_pid = new UnwinderFromPid(512, getpid());
173 ASSERT_TRUE(unwinder_from_pid->Init(regs->Arch()));
174 unwinder_from_pid->SetRegs(regs.get());
175 unwinder.reset(unwinder_from_pid);
176 }
177 VerifyUnwind(unwinder.get(), kFunctionOrder);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700178}
179
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800180extern "C" void MiddleFunction(TestTypeEnum test_type) {
181 InnerFunction(test_type);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700182}
183
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800184extern "C" void OuterFunction(TestTypeEnum test_type) {
185 MiddleFunction(test_type);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700186}
187
Christopher Ferrisedccd842017-09-06 14:15:28 -0700188class UnwindTest : public ::testing::Test {
189 public:
190 void SetUp() override { ResetGlobals(); }
191};
192
193TEST_F(UnwindTest, local) {
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800194 OuterFunction(TEST_TYPE_LOCAL_UNWINDER);
195}
196
197TEST_F(UnwindTest, local_use_from_pid) {
198 OuterFunction(TEST_TYPE_LOCAL_UNWINDER_FROM_PID);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700199}
200
Christopher Ferrisa0196652017-07-18 16:09:20 -0700201void WaitForRemote(pid_t pid, uint64_t addr, bool leave_attached, bool* completed) {
202 *completed = false;
203 // Need to sleep before attempting first ptrace. Without this, on the
Christopher Ferrisedccd842017-09-06 14:15:28 -0700204 // host it becomes impossible to attach and ptrace sets errno to EPERM.
Christopher Ferrisa0196652017-07-18 16:09:20 -0700205 usleep(1000);
Christopher Ferrisedccd842017-09-06 14:15:28 -0700206 for (size_t i = 0; i < 1000; i++) {
207 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) {
208 ASSERT_TRUE(TestQuiescePid(pid))
209 << "Waiting for process to quiesce failed: " << strerror(errno);
210
211 MemoryRemote memory(pid);
212 // Read the remote value to see if we are ready.
213 bool value;
Josh Gaoef35aa52017-10-18 11:44:51 -0700214 if (memory.ReadFully(addr, &value, sizeof(value)) && value) {
Christopher Ferrisedccd842017-09-06 14:15:28 -0700215 *completed = true;
Christopher Ferrisa0196652017-07-18 16:09:20 -0700216 }
Christopher Ferrisedccd842017-09-06 14:15:28 -0700217 if (!*completed || !leave_attached) {
218 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0));
219 }
220 if (*completed) {
221 break;
222 }
223 } else {
224 ASSERT_EQ(ESRCH, errno) << "ptrace attach failed with unexpected error: " << strerror(errno);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700225 }
Christopher Ferrisedccd842017-09-06 14:15:28 -0700226 usleep(5000);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700227 }
228}
229
Christopher Ferrisedccd842017-09-06 14:15:28 -0700230TEST_F(UnwindTest, remote) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700231 pid_t pid;
232 if ((pid = fork()) == 0) {
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800233 OuterFunction(TEST_TYPE_REMOTE);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700234 exit(0);
235 }
236 ASSERT_NE(-1, pid);
Christopher Ferrisedccd842017-09-06 14:15:28 -0700237 TestScopedPidReaper reap(pid);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700238
Christopher Ferrisa0196652017-07-18 16:09:20 -0700239 bool completed;
240 WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), true, &completed);
241 ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700242
243 RemoteMaps maps(pid);
244 ASSERT_TRUE(maps.Parse());
Josh Gao0953ecd2017-08-25 13:55:06 -0700245 std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700246 ASSERT_TRUE(regs.get() != nullptr);
247
Christopher Ferris5f118512017-09-01 11:17:16 -0700248 VerifyUnwind(pid, &maps, regs.get(), kFunctionOrder);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700249
Christopher Ferrisedccd842017-09-06 14:15:28 -0700250 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
251 << "ptrace detach failed with unexpected error: " << strerror(errno);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700252}
253
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800254TEST_F(UnwindTest, unwind_from_pid_remote) {
255 pid_t pid;
256 if ((pid = fork()) == 0) {
257 OuterFunction(TEST_TYPE_REMOTE);
258 exit(0);
259 }
260 ASSERT_NE(-1, pid);
261 TestScopedPidReaper reap(pid);
262
263 bool completed;
264 WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), true, &completed);
265 ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
266
267 std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
268 ASSERT_TRUE(regs.get() != nullptr);
269
270 UnwinderFromPid unwinder(512, pid);
271 ASSERT_TRUE(unwinder.Init(regs->Arch()));
272 unwinder.SetRegs(regs.get());
273
274 VerifyUnwind(&unwinder, kFunctionOrder);
275
276 // Verify that calling the same object works again.
277
278 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
279 << "ptrace detach failed with unexpected error: " << strerror(errno);
280}
281
Christopher Ferrisedccd842017-09-06 14:15:28 -0700282TEST_F(UnwindTest, from_context) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700283 std::atomic_int tid(0);
284 std::thread thread([&]() {
285 tid = syscall(__NR_gettid);
Christopher Ferrisbc6a7e52019-01-18 16:33:27 -0800286 OuterFunction(TEST_TYPE_LOCAL_WAIT_FOR_FINISH);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700287 });
288
289 struct sigaction act, oldact;
290 memset(&act, 0, sizeof(act));
Christopher Ferrisa0196652017-07-18 16:09:20 -0700291 act.sa_sigaction = SignalHandler;
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700292 act.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
293 ASSERT_EQ(0, sigaction(SIGUSR1, &act, &oldact));
294 // Wait for the tid to get set.
295 for (size_t i = 0; i < 100; i++) {
296 if (tid.load() != 0) {
297 break;
298 }
299 usleep(1000);
300 }
301 ASSERT_NE(0, tid.load());
Elliott Hughes38488902018-07-11 11:13:16 -0700302 ASSERT_EQ(0, tgkill(getpid(), tid.load(), SIGUSR1)) << "Error: " << strerror(errno);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700303
304 // Wait for context data.
305 void* ucontext;
Christopher Ferrisd226a512017-07-14 10:37:19 -0700306 for (size_t i = 0; i < 2000; i++) {
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700307 ucontext = reinterpret_cast<void*>(g_ucontext.load());
308 if (ucontext != nullptr) {
309 break;
310 }
311 usleep(1000);
312 }
313 ASSERT_TRUE(ucontext != nullptr) << "Timed out waiting for thread to respond to signal.";
314
315 LocalMaps maps;
316 ASSERT_TRUE(maps.Parse());
Christopher Ferrisd06001d2017-11-30 18:56:01 -0800317 std::unique_ptr<Regs> regs(Regs::CreateFromUcontext(Regs::CurrentArch(), ucontext));
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700318
Christopher Ferris5f118512017-09-01 11:17:16 -0700319 VerifyUnwind(getpid(), &maps, regs.get(), kFunctionOrder);
Christopher Ferris2a25c4a2017-07-07 16:35:48 -0700320
321 ASSERT_EQ(0, sigaction(SIGUSR1, &oldact, nullptr));
322
323 g_finish = true;
324 thread.join();
325}
Christopher Ferrisd226a512017-07-14 10:37:19 -0700326
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700327static void RemoteThroughSignal(int signal, unsigned int sa_flags) {
Christopher Ferrisa0196652017-07-18 16:09:20 -0700328 pid_t pid;
329 if ((pid = fork()) == 0) {
330 struct sigaction act, oldact;
331 memset(&act, 0, sizeof(act));
332 act.sa_sigaction = SignalCallerHandler;
333 act.sa_flags = SA_RESTART | SA_ONSTACK | sa_flags;
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700334 ASSERT_EQ(0, sigaction(signal, &act, &oldact));
Christopher Ferrisa0196652017-07-18 16:09:20 -0700335
Christopher Ferriseb0772f2018-12-05 15:57:02 -0800336 OuterFunction(signal != SIGSEGV ? TEST_TYPE_REMOTE : TEST_TYPE_REMOTE_WITH_INVALID_CALL);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700337 exit(0);
338 }
339 ASSERT_NE(-1, pid);
Christopher Ferrisedccd842017-09-06 14:15:28 -0700340 TestScopedPidReaper reap(pid);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700341
342 bool completed;
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700343 if (signal != SIGSEGV) {
344 WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_ready_for_remote), false, &completed);
345 ASSERT_TRUE(completed) << "Timed out waiting for remote process to be ready.";
346 ASSERT_EQ(0, kill(pid, SIGUSR1));
347 }
Christopher Ferrisa0196652017-07-18 16:09:20 -0700348 WaitForRemote(pid, reinterpret_cast<uint64_t>(&g_signal_ready_for_remote), true, &completed);
349 ASSERT_TRUE(completed) << "Timed out waiting for remote process to be in signal handler.";
350
351 RemoteMaps maps(pid);
352 ASSERT_TRUE(maps.Parse());
Josh Gao0953ecd2017-08-25 13:55:06 -0700353 std::unique_ptr<Regs> regs(Regs::RemoteGet(pid));
Christopher Ferrisa0196652017-07-18 16:09:20 -0700354 ASSERT_TRUE(regs.get() != nullptr);
355
Christopher Ferris5f118512017-09-01 11:17:16 -0700356 VerifyUnwind(pid, &maps, regs.get(), kFunctionSignalOrder);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700357
Christopher Ferrisedccd842017-09-06 14:15:28 -0700358 ASSERT_EQ(0, ptrace(PTRACE_DETACH, pid, 0, 0))
359 << "ptrace detach failed with unexpected error: " << strerror(errno);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700360}
361
Christopher Ferrisedccd842017-09-06 14:15:28 -0700362TEST_F(UnwindTest, remote_through_signal) {
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700363 RemoteThroughSignal(SIGUSR1, 0);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700364}
365
Christopher Ferrisedccd842017-09-06 14:15:28 -0700366TEST_F(UnwindTest, remote_through_signal_sa_siginfo) {
Christopher Ferrisb9de87f2017-09-20 13:37:24 -0700367 RemoteThroughSignal(SIGUSR1, SA_SIGINFO);
368}
369
370TEST_F(UnwindTest, remote_through_signal_with_invalid_func) {
371 RemoteThroughSignal(SIGSEGV, 0);
372}
373
374TEST_F(UnwindTest, remote_through_signal_sa_siginfo_with_invalid_func) {
375 RemoteThroughSignal(SIGSEGV, SA_SIGINFO);
Christopher Ferrisa0196652017-07-18 16:09:20 -0700376}
377
Christopher Ferrisbe788d82017-11-27 14:50:38 -0800378// Verify that using the same map while unwinding multiple threads at the
379// same time doesn't cause problems.
380TEST_F(UnwindTest, multiple_threads_unwind_same_map) {
381 static constexpr size_t kNumConcurrentThreads = 100;
382
383 LocalMaps maps;
384 ASSERT_TRUE(maps.Parse());
385 auto process_memory(Memory::CreateProcessMemory(getpid()));
386
387 std::vector<std::thread*> threads;
388
389 std::atomic_bool wait;
390 wait = true;
391 size_t frames[kNumConcurrentThreads];
392 for (size_t i = 0; i < kNumConcurrentThreads; i++) {
393 std::thread* thread = new std::thread([i, &frames, &maps, &process_memory, &wait]() {
394 while (wait)
395 ;
396 std::unique_ptr<Regs> regs(Regs::CreateFromLocal());
397 RegsGetLocal(regs.get());
398
399 Unwinder unwinder(512, &maps, regs.get(), process_memory);
400 unwinder.Unwind();
401 frames[i] = unwinder.NumFrames();
402 ASSERT_LE(3U, frames[i]) << "Failed for thread " << i;
403 });
404 threads.push_back(thread);
405 }
406 wait = false;
407 for (auto thread : threads) {
408 thread->join();
409 delete thread;
410 }
411}
412
Christopher Ferrisd226a512017-07-14 10:37:19 -0700413} // namespace unwindstack