Util/stack_trace.cpp: Clean duplicate functions in CallStack dump

This commit is contained in:
Elad
2026-09-23 23:13:17 +03:00
parent 56237b6858
commit 1e0e352f95
+29
View File
@@ -13,6 +13,33 @@
namespace utils
{
void clean_backtrace(std::vector<std::string>& 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