userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
stacktrace_cache.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/logging/stacktrace_cache.hpp
4
/// @brief Cached stringification for Boost stack traces.
5
/// @ingroup userver_universal
6
7
#
include
<
string
>
8
9
#
include
<
boost
/
stacktrace
/
stacktrace_fwd
.
hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
/// @brief Cached stringification for stack traces.
14
namespace
logging
::
stacktrace_cache
{
15
16
/// Get cached stacktrace
17
/// @see GlobalEnableStacktrace
18
std::string
to_string
(
const
boost::stacktrace::stacktrace& st);
// NOLINT(readability-identifier-naming)
19
20
/// @brief Resolve a single instruction address to a function name, using the
21
/// same per-frame cache as stacktrace_cache::to_string().
22
///
23
/// Unlike stacktrace_cache::to_string(), the name is returned unfiltered: no
24
/// frame is blanked out, so the result is usable for profile symbolization.
25
///
26
/// @returns The function name, or an empty string if the address cannot be
27
/// resolved or if stacktraces are disabled via GlobalEnableStacktrace().
28
std::string
SymbolizeAddress
(
const
void
* pc);
29
30
/// Enable/disable stacktraces. If disabled, stacktrace_cache::to_string()
31
/// returns with a const string.
32
///
33
/// @note Disabling stacktraces is a hack for the Boost.Stacktrace memory leak
34
bool
GlobalEnableStacktrace
(
bool
enable);
35
36
/// RAII-wrapper for `GlobalEnableStacktrace`. Should be used to temporarily
37
/// enable stacktraces after `GlobalEnableStacktrace(false)`.
38
class
StacktraceGuard
{
39
public
:
40
explicit
StacktraceGuard(
bool
enabled);
41
42
~StacktraceGuard();
43
44
private
:
45
const
bool
old_;
46
};
47
48
}
// namespace logging::stacktrace_cache
49
50
USERVER_NAMESPACE_END
userver
logging
stacktrace_cache.hpp
Generated on
for userver by
Doxygen
1.17.0