1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_ 6 #define QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "absl/types/span.h" 12 13 #include "quiche_platform_impl/quiche_stack_trace_impl.h" 14 15 namespace quiche { 16 CurrentStackTrace()17inline std::vector<void*> CurrentStackTrace() { 18 return CurrentStackTraceImpl(); 19 } 20 SymbolizeStackTrace(absl::Span<void * const> stacktrace)21inline std::string SymbolizeStackTrace(absl::Span<void* const> stacktrace) { 22 return SymbolizeStackTraceImpl(stacktrace); 23 } 24 25 // Returns a human-readable stack trace. Mostly used in error logging and 26 // related features. QuicheStackTrace()27inline std::string QuicheStackTrace() { return QuicheStackTraceImpl(); } 28 29 // Indicates whether the unit test for QuicheStackTrace() should be run. The 30 // unit test calls QuicheStackTrace() from a specific function and checks 31 // whether that specific function is in the stack trace. This function should 32 // return false if: 33 // (1) QuicheStackTrace() is unimplemented, 34 // (2) QuicheStackTrace() does not work on the current platform, or 35 // (3) QuicheStackTrace() works, but the symbols are not guaranteed to be 36 // available. QuicheShouldRunStackTraceTest()37inline bool QuicheShouldRunStackTraceTest() { 38 return QuicheShouldRunStackTraceTestImpl(); 39 } 40 41 } // namespace quiche 42 43 #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_STACK_TRACE_H_ 44