From 7ef92c354708b7643ff70e9b5d0e1c58e5baf930 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 29 Jan 2026 22:09:01 +0100 Subject: [PATCH] Add crash reason and thread information to LLM attachment, if appropriate. --- profiler/src/profiler/TracyView_Callstack.cpp | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/profiler/src/profiler/TracyView_Callstack.cpp b/profiler/src/profiler/TracyView_Callstack.cpp index fdf7a945..5bd7c004 100644 --- a/profiler/src/profiler/TracyView_Callstack.cpp +++ b/profiler/src/profiler/TracyView_Callstack.cpp @@ -32,6 +32,9 @@ void View::DrawCallstackWindow() void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton ) { + auto& crash = m_worker.GetCrashEvent(); + const bool hasCrashed = crash.thread != 0 && crash.callstack == callstack; + auto& cs = m_worker.GetCallstack( callstack ); if( ClipboardButton() ) { @@ -104,10 +107,22 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton ) } if( s_config.llm ) { + auto Attach = [&]() { + auto json = GetCallstackJson( cs ); + if( hasCrashed ) + { + json["crashed"] = true; + if( crash.message ) json["crash_reason"] = m_worker.GetString( crash.message ); + auto threadName = m_worker.GetThreadName( crash.thread ); + if( strcmp( threadName, "???" ) != 0 ) json["crash_thread"] = threadName; + } + AddLlmAttachment( json ); + }; + ImGui::SameLine(); if( ImGui::SmallButton( ICON_FA_ROBOT ) ) { - AddLlmAttachment( GetCallstackJson( cs ) ); + Attach(); } if( ImGui::IsItemHovered() && IsMouseClicked( ImGuiMouseButton_Right ) ) { @@ -117,13 +132,13 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton ) { if( ImGui::Selectable( "What is program doing at this moment?" ) ) { - AddLlmAttachment( GetCallstackJson( cs ) ); + Attach(); AddLlmQuery( "What is program doing at this moment?" ); ImGui::CloseCurrentPopup(); } if( ImGui::Selectable( "Walk me through the details of this callstack, step by step, explaining the code." ) ) { - AddLlmAttachment( GetCallstackJson( cs ) ); + Attach(); AddLlmQuery( "Walk me through the details of this callstack, step by step, explaining the code." ); ImGui::CloseCurrentPopup(); } @@ -147,8 +162,7 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton ) ImGui::SetNextItemWidth( ImGui::CalcTextSize( "Symbol address xxx" ).x ); ImGui::Combo( "##frameat", &m_showCallstackFrameAddress, "Source code\0Return address\0Symbol address\0Entry point\0" ); - auto& crash = m_worker.GetCrashEvent(); - if( crash.thread != 0 && crash.callstack == callstack ) + if( hasCrashed ) { ImGui::SameLine(); ImGui::Spacing();