Lines Matching refs:frames
46 void* frames[20]; in TEST() local
47 ASSERT_EQ(0, backtrace(frames, 0)); in TEST()
48 ASSERT_EQ(0, backtrace(frames, -1)); in TEST()
56 extern "C" __attribute__((__noinline__)) void CallTwo(std::vector<void*>& frames) { in CallTwo() argument
57 int num_frames = backtrace(frames.data(), static_cast<int>(frames.size())); in CallTwo()
59 frames.resize(static_cast<size_t>(num_frames)); in CallTwo()
62 extern "C" __attribute__((__noinline__)) void CallOne(std::vector<void*>& frames) { in CallOne() argument
63 CallTwo(frames); in CallOne()
67 static std::string DumpFrames(std::vector<void*>& frames) { in DumpFrames() argument
69 for (auto frame : frames) { in DumpFrames()
81 static size_t FindFunction(std::vector<void*>& frames, uintptr_t func_addr) { in FindFunction() argument
86 for (size_t i = 0; i < frames.size(); i++) { in FindFunction()
88 if (dladdr(frames[i], &frame_info) && func_info.dli_saddr == frame_info.dli_saddr) { in FindFunction()
95 static void VerifyCalls(std::vector<void*>& frames, size_t* one_idx = nullptr, in VerifyCalls() argument
98 size_t call_one_idx = FindFunction(frames, reinterpret_cast<uintptr_t>(&CallOne)); in VerifyCalls()
99 ASSERT_TRUE(call_one_idx != 0) << DumpFrames(frames); in VerifyCalls()
100 size_t call_two_idx = FindFunction(frames, reinterpret_cast<uintptr_t>(&CallTwo)); in VerifyCalls()
101 ASSERT_TRUE(call_two_idx != 0) << DumpFrames(frames); in VerifyCalls()
104 << DumpFrames(frames); in VerifyCalls()
111 std::vector<void*> frames(kMaxFrames); in TEST() local
112 ASSERT_NO_FATAL_FAILURE(CallOne(frames)); in TEST()
115 ASSERT_LT(3U, frames.size()) << DumpFrames(frames); in TEST()
117 VerifyCalls(frames); in TEST()
122 std::vector<void*> frames(1); in TEST() local
123 ASSERT_NO_FATAL_FAILURE(CallOne(frames)); in TEST()
124 ASSERT_EQ(1U, frames.size()) << DumpFrames(frames); in TEST()
128 void* frames[kMaxFrames]; in TEST() local
133 ASSERT_EQ(nullptr, backtrace_symbols(frames, 0)); in TEST()
135 ASSERT_EQ(nullptr, backtrace_symbols(frames, -1)); in TEST()
170 std::vector<void*> frames(kMaxFrames); in TEST() local
171 ASSERT_NO_FATAL_FAILURE(CallOne(frames)); in TEST()
172 ASSERT_LT(3U, frames.size()) << DumpFrames(frames); in TEST()
174 char** symbols = backtrace_symbols(frames.data(), static_cast<int>(frames.size())); in TEST()
176 for (size_t i = 0; i < frames.size(); i++) { in TEST()
177 ASSERT_TRUE(frames[i] != nullptr); in TEST()
183 ASSERT_NO_FATAL_FAILURE(VerifyCalls(frames, &call_one_idx, &call_two_idx)); in TEST()
185 SCOPED_TRACE(DumpFrames(frames)); in TEST()
192 void* frames[kMaxFrames]; in TEST() local
193 frames[0] = reinterpret_cast<void*>(&backtrace_symbols); in TEST()
197 backtrace_symbols_fd(frames, 0, tf.fd); in TEST()
207 backtrace_symbols_fd(frames, -1, tf.fd); in TEST()
216 backtrace_symbols_fd(frames, 0, -1); in TEST()
220 std::vector<void*> frames(kMaxFrames); in TEST() local
221 ASSERT_NO_FATAL_FAILURE(CallOne(frames)); in TEST()
222 ASSERT_LT(3U, frames.size()) << DumpFrames(frames); in TEST()
225 backtrace_symbols_fd(frames.data(), static_cast<int>(frames.size()), tf.fd); in TEST()
230 ASSERT_NO_FATAL_FAILURE(VerifyCalls(frames, &call_one_idx, &call_two_idx)); in TEST()
247 ASSERT_EQ(num_lines, frames.size()) << "Number of lines in file does not match number of frames."; in TEST()