diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt index 6c25ed2d..441cac06 100644 --- a/profiler/CMakeLists.txt +++ b/profiler/CMakeLists.txt @@ -244,6 +244,7 @@ Embed(PROFILER_FILES TextCompareTraces src/achievements/CompareTraces.md TEXT) Embed(PROFILER_FILES TextSamplingIntro src/achievements/SamplingIntro.md TEXT) Embed(PROFILER_FILES TextSamplingStats src/achievements/SamplingStats.md TEXT) Embed(PROFILER_FILES TextSaveTrace src/achievements/SaveTrace.md TEXT) +Embed(PROFILER_FILES TextSurviveCrash src/achievements/SurviveCrash.md TEXT) Embed(PROFILER_FILES TextZoneCallstacks src/achievements/ZoneCallstacks.md TEXT) Embed(PROFILER_FILES TextSections src/achievements/Sections.md TEXT) diff --git a/profiler/src/achievements/SurviveCrash.md b/profiler/src/achievements/SurviveCrash.md new file mode 100644 index 00000000..d7f1388b --- /dev/null +++ b/profiler/src/achievements/SurviveCrash.md @@ -0,0 +1,12 @@ +# Survive a crash + +When the application crashes, Tracy's [crash handler](#crashhandling) intercepts the fault, finishes sending the profiling data, and reports the crash: time, thread, reason, and the call stack at the crash site. Its * Call stack* button opens the stack where the fault occurred, and * Focus* jumps the timeline to the crash point. Crash handling runs automatically on Windows, Linux, and Android. + +After you close this report, the crash remains marked on the trace. On the timeline, the crashed thread's label reads * Crashed* in red. The * skull* button in the notification area reopens the crash stack. The Trace information window shows the crash's time, thread, and reason. + +> [!TIP] +> **Tip** +> +> The stack resolves into function names only if the profiler can read symbols from your binary, the same [requirement as call stack capture](#collectingcallstacks). + +Now crash your application on purpose and read the report. diff --git a/profiler/src/profiler/TracyAchievementData.cpp b/profiler/src/profiler/TracyAchievementData.cpp index 0e84816b..457af8b5 100644 --- a/profiler/src/profiler/TracyAchievementData.cpp +++ b/profiler/src/profiler/TracyAchievementData.cpp @@ -41,6 +41,7 @@ #include "data/TextSamplingStats.hpp" #include "data/TextSections.hpp" #include "data/TextSaveTrace.hpp" +#include "data/TextSurviveCrash.hpp" #include "data/TextZoneCallstacks.hpp" namespace tracy::data @@ -225,7 +226,13 @@ AchievementItem ai_frameStats = { .text = Unpack( TextFrameStatistics ) }; -AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, &ai_lightFlame, &ai_frameStats, nullptr }; +AchievementItem ai_surviveCrash = { + .id = "surviveCrash", + .name = "Survive a crash", + .text = Unpack( TextSurviveCrash ) +}; + +AchievementItem* ac_inspectZoneItems[] = { &ai_findZone, &ai_readSource, &ai_lightFlame, &ai_frameStats, &ai_surviveCrash, nullptr }; AchievementItem ai_inspectZone = { .id = "inspectZone", diff --git a/profiler/src/profiler/TracyView.cpp b/profiler/src/profiler/TracyView.cpp index 5e11d25f..dac38344 100644 --- a/profiler/src/profiler/TracyView.cpp +++ b/profiler/src/profiler/TracyView.cpp @@ -1324,6 +1324,7 @@ bool View::DrawImpl() if( crash.thread != 0 ) { m_reactToCrash = false; + if( s_config.achievements ) Achieve( "surviveCrash" ); ImGui::OpenPopup( "Application crashed!" ); } }