From 1e0e352f951850195c539550e08972c8c596987d Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Tue, 22 Sep 2026 18:39:49 +0300 Subject: [PATCH] Util/stack_trace.cpp: Clean duplicate functions in CallStack dump --- Utilities/stack_trace.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Utilities/stack_trace.cpp b/Utilities/stack_trace.cpp index 0a95269848..5a5381193e 100644 --- a/Utilities/stack_trace.cpp +++ b/Utilities/stack_trace.cpp @@ -13,6 +13,33 @@ namespace utils { + void clean_backtrace(std::vector& result) + { + for (usz it = 1, first_in_seq = 0, del_count = 0;;) + { + if (it >= result.size() || result[it] != result[first_in_seq]) + { + if (del_count) + { + fmt::append(result[first_in_seq], " x%u", del_count + 1); + } + + if (it < result.size()) + { + first_in_seq = it; + it++; + del_count = 0; + continue; + } + + break; + } + + result.erase(result.begin() + it); + del_count++; + } + } + #ifdef _WIN32 std::string wstr_to_utf8(LPWSTR data, int str_len) { @@ -139,6 +166,7 @@ namespace utils } } + clean_backtrace(result); return result; } #else @@ -166,6 +194,7 @@ namespace utils free(symbols); #endif + clean_backtrace(result); return result; } #endif