utility::debug class

contains some debug information, such as trace information, as well as utilities to debug.

types

classes

trace_info
contains the structure of a trace

static member functions

trace
method to get trace information of the current callstack.
public static
raw_trace
method to get raw trace information of the current callstack.
public static
register_thread
helper method to give a name to a specific thread.
public static
register_thread
helper method to name the current (this) thread.
public static
thread_name
gets the name of the given thread::id.
public static
thread_name
gets the name of the current (this) thread.
public static
func_to_class
helper method to extract just the class from a trace.
public static

Function documentation

static std::vector<trace_info> utility::debug::trace(size_t offset = 0u, size_t depth = 255u, std::optional<std::thread::id> id = std::nullopt)

Brief

method to get trace information of the current callstack.

Parameters
offset in what height of the callstack to start from (0 being the bottom, not root of the callstack).
depth in how far up should we get information from (i.e. a depth of 1 would only get the current information, while 255 would likely get you to the root).
id
Returns an std::vector containing a struct of trace_info of the current callstack (excluding this method).

static std::vector<void*> utility::debug::raw_trace(size_t offset = 0u, size_t depth = 255u)

Brief

method to get raw trace information of the current callstack.

Parameters
offset in what height of the callstack to start from (0 being the bottom, not root of the callstack).
depth in how far up should we get information from (i.e. a depth of 1 would only get the current information, while 255 would likely get you to the root).
Returns an std::vector containing void pointers pointing to the address of the current callstack (excluding this method).

static void utility::debug::register_thread(const std::thread::id& id, const psl::string8_t& name)

Brief

helper method to give a name to a specific thread.

Parameters
id in thread::id that will be named.
name in the name to assign to the given thread::id.

static void utility::debug::register_thread(const psl::string8_t& name)

Brief

helper method to name the current (this) thread.

Parameters
name in the name to assign to std::this_thread.

static const psl::string8_t utility::debug::thread_name(const std::thread::id& id)

Brief

gets the name of the given thread::id.

Parameters
id in the id of the thread to look up.
Returns the name (if any) that is assigned to the given thread::id.

static const psl::string8_t utility::debug::thread_name()

Brief

gets the name of the current (this) thread.

Returns the name (if any) that is assigned to the current thread.

static const psl::string8_t utility::debug::func_to_class(const char* fullFuncName)

Brief

helper method to extract just the class from a trace.

Parameters
fullFuncName in the signature of the trace.
Returns the class name.