From 57decf5875fcd964e855f9f8a3bed788e9c1dcf7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 14 Jan 2019 23:42:58 +0100 Subject: [PATCH] Display failure information. --- server/TracyView.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 42e27365..4db15e53 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -420,6 +420,12 @@ bool View::Draw() ImGui::OpenPopup( "Client not ready" ); } + const auto& failure = s_instance->m_worker.GetFailureType(); + if( failure != Worker::Failure::None ) + { + ImGui::OpenPopup( "Instrumentation failure" ); + } + if( ImGui::BeginPopupModal( "Protocol mismatch", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) { #ifdef TRACY_EXTENDED_FONT @@ -452,6 +458,53 @@ bool View::Draw() ImGui::EndPopup(); } + if( ImGui::BeginPopupModal( "Instrumentation failure", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) ) + { + const auto& data = s_instance->m_worker.GetFailureData(); + const auto& srcloc = s_instance->m_worker.GetSourceLocation( data.srcloc ); + +#ifdef TRACY_EXTENDED_FONT + TextCentered( ICON_FA_SKULL ); +#endif + ImGui::Text( "Profiling session terminated due to improper instrumentation.\nPlease correct your program and try again." ); + ImGui::Text( "Reason:" ); + ImGui::SameLine(); + switch( failure ) + { + case Worker::Failure::ZoneStack: + ImGui::Text( "Invalid order of zone begin and end events." ); + break; + default: + assert( false ); + break; + } + ImGui::Separator(); + if( srcloc.name.active ) + { + TextFocused( "Zone name:", s_instance->m_worker.GetString( srcloc.name ) ); + } + TextFocused( "Function:", s_instance->m_worker.GetString( srcloc.function ) ); + ImGui::TextDisabled( "Location:" ); + ImGui::SameLine(); + ImGui::Text( "%s:%i", s_instance->m_worker.GetString( srcloc.file ), srcloc.line ); + TextFocused( "Thread:", s_instance->m_worker.GetThreadString( data.thread ) ); + ImGui::SameLine(); + ImGui::TextDisabled( "(id)" ); + if( ImGui::IsItemHovered() ) + { + ImGui::BeginTooltip(); + ImGui::Text( "0x%" PRIX64, data.thread ); + ImGui::EndTooltip(); + } + ImGui::Separator(); + if( ImGui::Button( "I understand" ) ) + { + ImGui::CloseCurrentPopup(); + s_instance->m_worker.ClearFailure(); + } + ImGui::EndPopup(); + } + return s_instance->DrawImpl(); }