Commit 8336eb31 authored by Tudor Bosman's avatar Tudor Bosman Committed by Jordan DeLong

stack_trace_test was broken in debug mode

Summary: A function was getting inlined in opt mode but not in debug mode.

Test Plan: ran test

Reviewed By: philipp@fb.com

FB internal diff: D1130949

@override-unit-failures
test fix only
parent 054af315
......@@ -74,13 +74,20 @@ bool fixFrameArray(FrameArray<N>& fa, ssize_t n) {
}
} // namespace detail
// Always inline these functions; they don't do much, and unittests rely
// on them never showing up in a stack trace.
template <size_t N>
bool getStackTrace(FrameArray<N>& fa) {
inline bool getStackTrace(FrameArray<N>& fa) __attribute__((always_inline));
template <size_t N>
inline bool getStackTrace(FrameArray<N>& fa) {
return detail::fixFrameArray(fa, getStackTrace(fa.addresses, N));
}
template <size_t N>
inline bool getStackTraceSafe(FrameArray<N>& fa) __attribute__((always_inline));
template <size_t N>
bool getStackTraceSafe(FrameArray<N>& fa) {
inline bool getStackTraceSafe(FrameArray<N>& fa) {
return detail::fixFrameArray(fa, getStackTraceSafe(fa.addresses, N));
}
......
/*
* Copyright 2013 Facebook, Inc.
* Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -36,6 +36,19 @@ void verifyStackTraces() {
CHECK_EQ(fa.frameCount, faSafe.frameCount);
if (VLOG_IS_ON(1)) {
Symbolizer symbolizer;
OStreamSymbolizePrinter printer(std::cerr, SymbolizePrinter::COLOR_IF_TTY);
symbolizer.symbolize(fa);
VLOG(1) << "getStackTrace\n";
printer.println(fa);
symbolizer.symbolize(faSafe);
VLOG(1) << "getStackTraceSafe\n";
printer.println(faSafe);
}
// Other than the top 2 frames (this one and getStackTrace /
// getStackTraceSafe), the stack traces should be identical
for (size_t i = 2; i < fa.frameCount; ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment