From aca0f3cad7b86aee5a2a191738d3ed94d8817db0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 24 Sep 2024 19:39:53 +0200 Subject: [PATCH] Workaround failing assert. The aggregate inlines code branch can fail when the top inlines option is enabled, on an assert. This was present in the code before, it's just that enabling top inlines is equivalent to expanding all the collapsed symbols, which is not something practical to do. Workaround by adding a condition instead of the assert. Finding a repro case would be better to figure out what's exactly happening there, but we are where we are. --- profiler/src/profiler/TracyView_Samples.cpp | 50 +++++++++++---------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/profiler/src/profiler/TracyView_Samples.cpp b/profiler/src/profiler/TracyView_Samples.cpp index 9b7da79f..ab29117b 100644 --- a/profiler/src/profiler/TracyView_Samples.cpp +++ b/profiler/src/profiler/TracyView_Samples.cpp @@ -304,40 +304,42 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu auto symAddr = *inSym; auto sit = inlineMap.find( symAddr ); auto sym = symMap.find( symAddr ); - assert( sym != symMap.end() ); - auto mit = mergeMap.find( sym->second.name.Idx() ); - if( mit == mergeMap.end() ) + if( sym != symMap.end() ) { - mergeMap.emplace( sym->second.name.Idx(), symAddr ); - } - else - { - symAddr = mit->second; - } - if( sit != inlineMap.end() ) - { - auto oit = outMap.find( symAddr ); - if( oit == outMap.end() ) + auto mit = mergeMap.find( sym->second.name.Idx() ); + if( mit == mergeMap.end() ) { - outMap.emplace( symAddr, SymList { symAddr, sit->second.incl, sit->second.excl, 1 } ); + mergeMap.emplace( sym->second.name.Idx(), symAddr ); } else { - oit->second.incl += sit->second.incl; - oit->second.excl += sit->second.excl; - oit->second.count++; + symAddr = mit->second; } - } - else - { - auto oit = outMap.find( symAddr ); - if( oit == outMap.end() ) + if( sit != inlineMap.end() ) { - outMap.emplace( symAddr, SymList { symAddr, 0, 0, 1 } ); + auto oit = outMap.find( symAddr ); + if( oit == outMap.end() ) + { + outMap.emplace( symAddr, SymList { symAddr, sit->second.incl, sit->second.excl, 1 } ); + } + else + { + oit->second.incl += sit->second.incl; + oit->second.excl += sit->second.excl; + oit->second.count++; + } } else { - oit->second.count++; + auto oit = outMap.find( symAddr ); + if( oit == outMap.end() ) + { + outMap.emplace( symAddr, SymList { symAddr, 0, 0, 1 } ); + } + else + { + oit->second.count++; + } } } inSym++;