1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Don't show invalid contents warning for disassembly.

This commit is contained in:
Bartosz Taudul 2020-03-27 17:14:46 +01:00
parent 39923e942b
commit 52a853b26f
2 changed files with 11 additions and 9 deletions

View File

@ -135,6 +135,8 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
void SourceView::Render( const Worker& worker ) void SourceView::Render( const Worker& worker )
{ {
if( m_file ) TextFocused( "File:", m_file );
if( !m_asm.empty() && !m_lines.empty() ) if( !m_asm.empty() && !m_lines.empty() )
{ {
if( SmallCheckbox( ICON_FA_MICROCHIP " Show assembly", &m_showAsm ) ) if( SmallCheckbox( ICON_FA_MICROCHIP " Show assembly", &m_showAsm ) )
@ -219,6 +221,15 @@ void SourceView::Render( const Worker& worker )
TextFocused( "Symbol:", worker.GetString( sym->name ) ); TextFocused( "Symbol:", worker.GetString( sym->name ) );
} }
if( !m_showAsm )
{
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "The source file contents might not reflect the actual profiled code!" );
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
}
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true ); ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true );
if( m_font ) ImGui::PushFont( m_font ); if( m_font ) ImGui::PushFont( m_font );
const auto nw = ImGui::CalcTextSize( "123,345" ).x; const auto nw = ImGui::CalcTextSize( "123,345" ).x;

View File

@ -12669,15 +12669,6 @@ void View::DrawTextEditor()
ImGui::SetNextWindowSize( ImVec2( 700, 800 ), ImGuiCond_FirstUseEver ); ImGui::SetNextWindowSize( ImVec2( 700, 800 ), ImGuiCond_FirstUseEver );
bool show = true; bool show = true;
ImGui::Begin( "Source view", &show ); ImGui::Begin( "Source view", &show );
if( m_sourceViewFile != (const char*)~uint64_t( 0 ) )
{
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "The source file contents might not reflect the actual profiled code!" );
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
TextFocused( "File:", m_sourceViewFile );
}
m_sourceView->Render( m_worker ); m_sourceView->Render( m_worker );
ImGui::End(); ImGui::End();
if( !show ) m_sourceViewFile = nullptr; if( !show ) m_sourceViewFile = nullptr;