mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-21 18:22:33 +01:00
21 lines
478 B
C
21 lines
478 B
C
|
#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);
|
||
|
}
|
||
|
}
|
||
|
}
|