}
} // 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.
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) {