Handle ending a zone twice.

This commit is contained in:
Bartosz Taudul 2020-04-30 19:05:13 +02:00
parent a40ba8f4e9
commit b74caae685
2 changed files with 15 additions and 0 deletions

View File

@ -4337,6 +4337,11 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev )
auto td = m_threadCtxData;
assert( td );
if( td->zoneIdStack.empty() )
{
ZoneDoubleEndFailure( m_threadCtx, td->timeline.empty() ? nullptr : td->timeline.back() );
return;
}
auto zoneId = td->zoneIdStack.back_and_pop();
if( zoneId != td->nextZoneId )
{
@ -4422,6 +4427,13 @@ void Worker::ZoneStackFailure( uint64_t thread, const ZoneEvent* ev )
m_failureData.srcloc = ev->SrcLoc();
}
void Worker::ZoneDoubleEndFailure( uint64_t thread, const ZoneEvent* ev )
{
m_failure = Failure::ZoneDoubleEnd;
m_failureData.thread = thread;
m_failureData.srcloc = ev ? ev->SrcLoc() : 0;
}
void Worker::ZoneTextFailure( uint64_t thread )
{
m_failure = Failure::ZoneText;
@ -7215,6 +7227,7 @@ void Worker::WriteTimelineImpl( FileWrite& f, const V& vec, int64_t& refTime, in
static const char* s_failureReasons[] = {
"<unknown reason>",
"Invalid order of zone begin and end events.",
"Zone is ended twice.",
"Zone text transfer destination doesn't match active zone.",
"Zone name transfer destination doesn't match active zone.",
"Memory free event without a matching allocation.",

View File

@ -349,6 +349,7 @@ public:
{
None,
ZoneStack,
ZoneDoubleEnd,
ZoneText,
ZoneName,
MemFree,
@ -615,6 +616,7 @@ private:
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
void ZoneStackFailure( uint64_t thread, const ZoneEvent* ev );
void ZoneDoubleEndFailure( uint64_t thread, const ZoneEvent* ev );
void ZoneTextFailure( uint64_t thread );
void ZoneNameFailure( uint64_t thread );
void MemFreeFailure( uint64_t thread );