mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Symbol file selector.
This commit is contained in:
parent
a1bad4b7be
commit
bb338a1c97
@ -246,7 +246,7 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
|
|||||||
auto sit = m_sourceFiles.find( idx );
|
auto sit = m_sourceFiles.find( idx );
|
||||||
if( sit == m_sourceFiles.end() )
|
if( sit == m_sourceFiles.end() )
|
||||||
{
|
{
|
||||||
m_sourceFiles.emplace( idx );
|
m_sourceFiles.emplace( idx, srcline );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -408,7 +408,7 @@ void SourceView::RenderSymbolView( const Worker& worker )
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth( -1 );
|
ImGui::SetNextItemWidth( -1 );
|
||||||
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
||||||
if( ImGui::BeginCombo( "", worker.GetString( sym->name ), ImGuiComboFlags_HeightLargest ) )
|
if( ImGui::BeginCombo( "##functionList", worker.GetString( sym->name ), ImGuiComboFlags_HeightLargest ) )
|
||||||
{
|
{
|
||||||
for( auto& v : symInline )
|
for( auto& v : symInline )
|
||||||
{
|
{
|
||||||
@ -545,11 +545,50 @@ void SourceView::RenderSymbolView( const Worker& worker )
|
|||||||
|
|
||||||
void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<uint64_t, uint32_t> ipcount, const Worker& worker )
|
void SourceView::RenderSymbolSourceView( uint32_t iptotal, unordered_flat_map<uint64_t, uint32_t> ipcount, const Worker& worker )
|
||||||
{
|
{
|
||||||
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
|
if( m_sourceFiles.empty() )
|
||||||
ImGui::SameLine();
|
{
|
||||||
TextColoredUnformatted( ImVec4( 1.f, 0.3f, 0.3f, 1.f ), "The source file contents might not reflect the actual profiled code!" );
|
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
|
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 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
|
||||||
|
if( ImGui::IsItemHovered() )
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
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::EndTooltip();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
TextDisabledUnformatted( "File:" );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth( -1 );
|
||||||
|
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
||||||
|
if( ImGui::BeginCombo( "##fileList", m_file, ImGuiComboFlags_HeightLargest ) )
|
||||||
|
{
|
||||||
|
for( auto& v : m_sourceFiles )
|
||||||
|
{
|
||||||
|
auto fstr = worker.GetString( StringIdx( v.first ) );
|
||||||
|
ImGui::PushID( v.first );
|
||||||
|
if( ImGui::Selectable( fstr, fstr == m_file ) )
|
||||||
|
{
|
||||||
|
ParseSource( fstr, &worker );
|
||||||
|
m_targetLine = v.second;
|
||||||
|
m_selectedLine = v.second;
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
|
|
||||||
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 );
|
||||||
|
@ -91,7 +91,7 @@ private:
|
|||||||
int m_maxJumpLevel;
|
int m_maxJumpLevel;
|
||||||
bool m_showJumps;
|
bool m_showJumps;
|
||||||
|
|
||||||
unordered_flat_set<uint32_t> m_sourceFiles;
|
unordered_flat_map<uint32_t, uint32_t> m_sourceFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user