[ox/std] Fix stacktrace shave

This commit is contained in:
Gary Talent 2021-05-07 07:01:04 -05:00
parent 0f1fbe40dd
commit 800e04b3b9

View File

@ -57,7 +57,7 @@ void printStackTrace([[maybe_unused]]unsigned shave) noexcept {
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), frames.size()))); frames.resize(static_cast<std::size_t>(backtrace(frames.data(), frames.size())));
if (frames.size() > shave) { if (frames.size() > shave) {
const auto symbols = backtrace_symbols(frames.data() + shave, frames.size() - shave); const auto symbols = backtrace_symbols(frames.data() + shave, frames.size() - shave);
const auto symbolicatedStacktrace = symbolicate(bit_cast<const char**>(frames.data()), frames.size() - shave, "\t"); const auto symbolicatedStacktrace = symbolicate(bit_cast<const char**>(frames.data() + shave), frames.size() - shave, "\t");
free(symbols); free(symbols);
oxErrf("Stacktrace:\n{}", symbolicatedStacktrace); oxErrf("Stacktrace:\n{}", symbolicatedStacktrace);
} }