Call stack window may now display frame addresses.

This commit is contained in:
Bartosz Taudul 2018-08-21 17:55:59 +02:00
parent 7df12652b1
commit 6ad184447a
2 changed files with 29 additions and 7 deletions

View File

@ -333,6 +333,7 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb )
, m_onlyContendedLocks( true ) , m_onlyContendedLocks( true )
, m_statSort( 0 ) , m_statSort( 0 )
, m_statSelf( false ) , m_statSelf( false )
, m_showCallstackFrameAddress( false )
, m_namespace( Namespace::Full ) , m_namespace( Namespace::Full )
, m_textEditorFont( fixedWidth ) , m_textEditorFont( fixedWidth )
, m_stcb( stcb ) , m_stcb( stcb )
@ -378,6 +379,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
, m_onlyContendedLocks( true ) , m_onlyContendedLocks( true )
, m_statSort( 0 ) , m_statSort( 0 )
, m_statSelf( false ) , m_statSelf( false )
, m_showCallstackFrameAddress( false )
, m_namespace( Namespace::Full ) , m_namespace( Namespace::Full )
, m_textEditorFont( fixedWidth ) , m_textEditorFont( fixedWidth )
, m_stcb( stcb ) , m_stcb( stcb )
@ -6087,6 +6089,12 @@ void View::DrawCallstackWindow()
bool show = true; bool show = true;
ImGui::Begin( "Call stack", &show ); ImGui::Begin( "Call stack", &show );
#ifdef TRACY_EXTENDED_FONT
ImGui::Checkbox( ICON_FA_AT " Show frame addresses", &m_showCallstackFrameAddress );
#else
ImGui::Checkbox( "Show frame addresses", &m_showCallstackFrameAddress );
#endif
auto& cs = m_worker.GetCallstack( m_callstackInfoWindow ); auto& cs = m_worker.GetCallstack( m_callstackInfoWindow );
ImGui::Columns( 3 ); ImGui::Columns( 3 );
@ -6152,17 +6160,30 @@ void View::DrawCallstackWindow()
ImGui::Indent( indentVal ); ImGui::Indent( indentVal );
} }
txt = m_worker.GetString( frame->file ); txt = m_worker.GetString( frame->file );
if( frame->line == 0 ) if( m_showCallstackFrameAddress )
{ {
ImGui::TextDisabled( "%s", txt ); ImGui::TextDisabled( "0x%" PRIx64, entry );
if( ImGui::IsItemClicked() )
{
char tmp[32];
sprintf( tmp, "0x%" PRIx64, entry );
ImGui::SetClipboardText( tmp );
}
} }
else else
{ {
ImGui::TextDisabled( "%s:%i", txt, frame->line ); if( frame->line == 0 )
} {
if( ImGui::IsItemClicked() ) ImGui::TextDisabled( "%s", txt );
{ }
ImGui::SetClipboardText( txt ); else
{
ImGui::TextDisabled( "%s:%i", txt, frame->line );
}
if( ImGui::IsItemClicked() )
{
ImGui::SetClipboardText( txt );
}
} }
if( ImGui::IsItemClicked( 1 ) ) if( ImGui::IsItemClicked( 1 ) )
{ {

View File

@ -245,6 +245,7 @@ private:
int m_statSort; int m_statSort;
bool m_statSelf; bool m_statSelf;
bool m_showCallstackFrameAddress;
Namespace m_namespace; Namespace m_namespace;
Animation m_zoomAnim; Animation m_zoomAnim;