mimic++ v6
|
Contains stacktrace related functionalities. More...
Concepts | |
concept | mimicpp::stacktrace::backend |
Checks whether the given type satisfies the requirements of a stacktrace backend. | |
Classes | |
struct | mimicpp::stacktrace::backend_traits< Backend > |
Trait type for stacktrace backends. More... | |
class | mimicpp::Stacktrace |
A simple type-erase stacktrace abstraction. More... | |
Variables | |
constexpr detail::current_hook::current_fn | mimicpp::stacktrace::current {} |
Function object, which generates the current-stacktrace. | |
Contains stacktrace related functionalities.
As mimic++
is officially a C++20 framework, it can not rely on built-in stack trace support from the STL. However, stack traces are particularly valuable for users in the context of mocking, especially when expectations are violated. To address this, mimic++
introduces a simple stacktrace abstraction that can be used to integrate existing stacktrace implementations.
cpptrace::stacktrace
is selected as the default stacktrace-backend.std::stacktrace
is available (i.e. c++23 is available), it's selected as the default stacktrace-backend.stacktrace::NullBackend
is selected, which does not provide any valuable information.NDEBUG
is defined), because neither std::stacktrace
nor cpptrace
do provide correct information. In this case the stacktrace::NullBackend
is chosen as the active stacktrace-backend.In any case, users can define mimicpp::custom::find_stacktrace_backend
to enable their own stacktrace-backend, which will then be preferred over any other stacktrace-backend (even for non-debug builds). That type must contain at least a type
member-alias, which denotes the desired stacktrace-backend implementation.
Additionally, a specialization for the stacktrace::backend_traits
template must be added, which defines at least the following functions:
index
param denotes the index of the selected stacktrace-entry.
|
constexpr |
Function object, which generates the current-stacktrace.
This function skips at least all internal stacktrace-entries. Callers may specify the optional skip
parameter to remove additional entries.