|
4 | 4 |
|
5 | 5 | #include <ydb/library/actors/prof/tag.h>
|
6 | 6 | #include <library/cpp/cache/cache.h>
|
| 7 | +#include <library/cpp/dwarf_backtrace/backtrace.h> |
7 | 8 | #include <library/cpp/html/pcdata/pcdata.h>
|
8 | 9 | #include <library/cpp/monlib/service/pages/templates.h>
|
9 | 10 |
|
@@ -206,25 +207,15 @@ class TAllocationAnalyzer {
|
206 | 207 | bool Prepared = false;
|
207 | 208 |
|
208 | 209 | private:
|
209 |
| - void PrintBackTrace(IOutputStream& out, void* const* stack, size_t sz, |
210 |
| - const char* sep) |
211 |
| - { |
212 |
| - char name[1024]; |
213 |
| - for (size_t i = 0; i < sz; ++i) { |
214 |
| - TSymbol symbol; |
215 |
| - auto it = SymbolCache.Find(stack[i]); |
216 |
| - if (it != SymbolCache.End()) { |
217 |
| - symbol = it.Value(); |
218 |
| - } else { |
219 |
| - TResolvedSymbol rs = ResolveSymbol(stack[i], name, sizeof(name)); |
220 |
| - symbol = {rs.NearestSymbol, rs.Name}; |
221 |
| - SymbolCache.Insert(stack[i], symbol); |
222 |
| - } |
223 |
| - |
224 |
| - out << Hex((intptr_t)stack[i], HF_FULL) << " " << symbol.Name; |
225 |
| - intptr_t offset = (intptr_t)stack[i] - (intptr_t)symbol.Address; |
226 |
| - if (offset) |
227 |
| - out << " +" << offset; |
| 210 | + void PrintBackTrace(IOutputStream& out, void* const* stack, size_t size, const char* sep) { |
| 211 | + // TODO: ignore symbol cache for now - because of inlines. |
| 212 | + if (auto error = NDwarf::ResolveBacktrace(TArrayRef<const void* const>(stack, size), [&](const NDwarf::TLineInfo& info) { |
| 213 | + out << "#" << info.Index << " " << info.FunctionName << " at " << info.FileName << ':' << info.Line << ':' << info.Col << sep; |
| 214 | + return NDwarf::EResolving::Continue; |
| 215 | + })) { |
| 216 | + // TODO: print error message. |
| 217 | + out << "Failed to resolve stacktrace: " << error->Message << sep; |
| 218 | + } else { |
228 | 219 | out << sep;
|
229 | 220 | }
|
230 | 221 | }
|
|
0 commit comments