Enable display of symbol address in callstack window.

This commit is contained in:
Bartosz Taudul 2020-02-26 19:01:21 +01:00
parent 890cec9872
commit 02c99fca67
2 changed files with 42 additions and 14 deletions

View File

@ -11121,10 +11121,18 @@ void View::DrawCallstackWindow()
ImGui::Begin( "Call stack", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); ImGui::Begin( "Call stack", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
#ifdef TRACY_EXTENDED_FONT #ifdef TRACY_EXTENDED_FONT
ImGui::Checkbox( ICON_FA_AT " Show frame addresses", &m_showCallstackFrameAddress ); ImGui::TextUnformatted( ICON_FA_AT " Frame location:" );
#else #else
ImGui::Checkbox( "Show frame addresses", &m_showCallstackFrameAddress ); ImGui::Checkbox( "Frame location:" );
#endif #endif
ImGui::SameLine();
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
ImGui::RadioButton( "Source code", &m_showCallstackFrameAddress, 0 );
ImGui::SameLine();
ImGui::RadioButton( "Return address", &m_showCallstackFrameAddress, 1 );
ImGui::SameLine();
ImGui::RadioButton( "Symbol address", &m_showCallstackFrameAddress, 2 );
ImGui::PopStyleVar();
auto& cs = m_worker.GetCallstack( m_callstackInfoWindow ); auto& cs = m_worker.GetCallstack( m_callstackInfoWindow );
@ -11238,8 +11246,23 @@ void View::DrawCallstackWindow()
ImGui::Indent( indentVal ); ImGui::Indent( indentVal );
} }
txt = m_worker.GetString( frame.file ); txt = m_worker.GetString( frame.file );
if( m_showCallstackFrameAddress ) switch( m_showCallstackFrameAddress )
{ {
case 0:
if( frame.line == 0 )
{
TextDisabledUnformatted( txt );
}
else
{
ImGui::TextDisabled( "%s:%i", txt, frame.line );
}
if( ImGui::IsItemClicked() )
{
ImGui::SetClipboardText( txt );
}
break;
case 1:
if( entry.sel == 0 ) if( entry.sel == 0 )
{ {
const auto addr = m_worker.GetCanonicalPointer( entry ); const auto addr = m_worker.GetCanonicalPointer( entry );
@ -11255,22 +11278,27 @@ void View::DrawCallstackWindow()
{ {
ImGui::TextDisabled( "Custom #%" PRIu64, entry.idx ); ImGui::TextDisabled( "Custom #%" PRIu64, entry.idx );
} }
} break;
else case 2:
if( entry.sel == 0 )
{ {
if( frame.line == 0 ) ImGui::TextDisabled( "0x%" PRIx64, frame.symAddr );
{
TextDisabledUnformatted( txt );
}
else
{
ImGui::TextDisabled( "%s:%i", txt, frame.line );
}
if( ImGui::IsItemClicked() ) if( ImGui::IsItemClicked() )
{ {
ImGui::SetClipboardText( txt ); char tmp[32];
sprintf( tmp, "0x%" PRIx64, frame.symAddr );
ImGui::SetClipboardText( tmp );
} }
} }
else
{
ImGui::TextDisabled( "Custom #%" PRIu64, entry.idx );
}
break;
default:
assert( false );
break;
}
if( ImGui::IsItemClicked( 1 ) ) if( ImGui::IsItemClicked( 1 ) )
{ {
if( SourceFileValid( txt, m_worker.GetCaptureTime() ) ) if( SourceFileValid( txt, m_worker.GetCaptureTime() ) )

View File

@ -343,7 +343,7 @@ private:
int m_statSort = 0; int m_statSort = 0;
bool m_statSelf = false; bool m_statSelf = false;
bool m_showCallstackFrameAddress = false; int m_showCallstackFrameAddress = 0;
bool m_showUnknownFrames = true; bool m_showUnknownFrames = true;
bool m_groupChildrenLocations = false; bool m_groupChildrenLocations = false;
bool m_allocTimeRelativeToZone = true; bool m_allocTimeRelativeToZone = true;