blob: b3e6c3f8d83dad0c5442c315150e027531f7d12f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <library/cpp/dwarf_backtrace/backtrace.h>
#include <util/stream/format.h>
#include <util/system/backtrace.h>
namespace {
void PrintDwarfBacktrace(IOutputStream* out, void* const* backtrace, size_t size) {
auto error = NDwarf::ResolveBacktrace({backtrace, size}, [out](const NDwarf::TLineInfo& info) {
*out << info.FileName << ":" << info.Line << ":" << info.Col
<< " in " << info.FunctionName << " (" << Hex(info.Address, HF_ADDX) << ')' << Endl;
return NDwarf::EResolving::Continue;
});
if (error) {
*out << "***Cannot get backtrace: " << error->Message << " (" << error->Code << ")***" << Endl;
}
}
[[maybe_unused]] auto _ = SetFormatBackTraceFn(&PrintDwarfBacktrace);
}
|