blob: 19cb41e79517a7b0c720db0d17b1327b4a1845a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <library/cpp/yt/backtrace/backtrace.h>
#include <library/cpp/yt/string/raw_formatter.h>
namespace NYT::NBacktrace {
////////////////////////////////////////////////////////////////////////////////
void SymbolizeBacktrace(
TBacktrace backtrace,
const std::function<void(TStringBuf)>& frameCallback)
{
for (int index = 0; index < std::ssize(backtrace); ++index) {
TRawFormatter<1024> formatter;
formatter.AppendNumber(index + 1, 10, 2);
formatter.AppendString(". ");
formatter.AppendNumberAsHexWithPadding(reinterpret_cast<uintptr_t>(backtrace[index]), 12);
formatter.AppendString("\n");
frameCallback(formatter.GetBuffer());
}
}
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NBacktrace
|