aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/backtrace/symbolizers/dummy/dummy_symbolizer.cpp
blob: 3b1d37aa0282a7fa06d74f58fce2d680ceb51eb4 (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(". 0x");
        formatter.AppendNumber(reinterpret_cast<uintptr_t>(backtrace[index]), /*radix*/ 16, /*width*/ 12);
        formatter.AppendString("\n");
        frameCallback(formatter.GetBuffer());
    }
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NBacktrace