1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00
rpcs3/Utilities/stack_trace.h

21 lines
478 B
C
Raw Normal View History

2022-08-14 02:36:53 +02:00
#pragma once
#include <util/types.hpp>
#include <util/logs.hpp>
namespace utils
{
std::vector<void*> backtrace(int max_depth = 255);
std::vector<std::string> backtrace_symbols(const std::vector<void*>& stack);
FORCE_INLINE void print_trace(logs::channel& logger, int max_depth = 255)
{
const auto trace = backtrace(max_depth);
const auto lines = backtrace_symbols(trace);
for (const auto& line : lines)
{
logger.error("%s", line);
}
}
}