44
55#include < ydb/library/actors/prof/tag.h>
66#include < library/cpp/cache/cache.h>
7- #include < library/cpp/dwarf_backtrace/backtrace.h>
7+
8+ #if defined(USE_DWARF_BACKTRACE)
9+ # include < library/cpp/dwarf_backtrace/backtrace.h>
10+ #endif
11+
812#include < library/cpp/html/pcdata/pcdata.h>
913#include < library/cpp/monlib/service/pages/templates.h>
1014
@@ -207,6 +211,7 @@ class TAllocationAnalyzer {
207211 bool Prepared = false ;
208212
209213private:
214+ #if defined(USE_DWARF_BACKTRACE)
210215 void PrintBackTrace (IOutputStream& out, void * const * stack, size_t size, const char * sep) {
211216 // TODO: ignore symbol cache for now - because of inlines.
212217 if (auto error = NDwarf::ResolveBacktrace (TArrayRef<const void * const >(stack, size), [&](const NDwarf::TLineInfo& info) {
@@ -219,6 +224,28 @@ class TAllocationAnalyzer {
219224 out << sep;
220225 }
221226 }
227+ #else
228+ void PrintBackTrace (IOutputStream& out, void * const * stack, size_t sz, const char * sep) {
229+ char name[1024 ];
230+ for (size_t i = 0 ; i < sz; ++i) {
231+ TSymbol symbol;
232+ auto it = SymbolCache.Find (stack[i]);
233+ if (it != SymbolCache.End ()) {
234+ symbol = it.Value ();
235+ } else {
236+ TResolvedSymbol rs = ResolveSymbol (stack[i], name, sizeof (name));
237+ symbol = {rs.NearestSymbol , rs.Name };
238+ SymbolCache.Insert (stack[i], symbol);
239+ }
240+
241+ out << Hex ((intptr_t )stack[i], HF_FULL) << " " << symbol.Name ;
242+ intptr_t offset = (intptr_t )stack[i] - (intptr_t )symbol.Address ;
243+ if (offset)
244+ out << " +" << offset;
245+ out << sep;
246+ }
247+ }
248+ #endif
222249
223250 void PrintSample (IOutputStream& out, const tcmalloc::Profile::Sample* sample,
224251 const char * sep) const
0 commit comments