mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Implement cross-symbol jumping.
This commit is contained in:
parent
013bb5a4f2
commit
9837e06816
@ -2631,7 +2631,7 @@ Unlike other profilers, Tracy doesn't include inlined function statistics in the
|
||||
|
||||
If executable code retrieval was performed, as described in section~\ref{executableretrieval}, and the view has symbol context available, you will be presented with an additional option, \emph{\faMicrochip{}~Show assembly}. Selecting it will replace the source code view with disassembly of the relevant portion of the program that was profiled.
|
||||
|
||||
Machine code instructions jumping to a predefined address will display symbol name of the jump target. If the destination location is within the currently displayed symbol an \texttt{->}~arrow will be prepended to the name. Hovering the \faMousePointer{}~mouse pointer over such symbol name will highlight the target location. Clicking on it with the \LMB{}~left mouse button will focus the view on the destination instruction.
|
||||
Machine code instructions jumping to a predefined address will display symbol name of the jump target. If the destination location is within the currently displayed symbol an \texttt{->}~arrow will be prepended to the name. Hovering the \faMousePointer{}~mouse pointer over such symbol name will highlight the target location. Clicking on it with the \LMB{}~left mouse button will focus the view on the destination instruction, or switch view to the destination symbol.
|
||||
|
||||
Unlike the source file view, portions of the executable are stored within the captured profile and don't rely on the local disk files being available.
|
||||
|
||||
|
@ -277,6 +277,7 @@ void SourceView::Render( const Worker& worker )
|
||||
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
|
||||
}
|
||||
|
||||
uint64_t jumpOut = 0;
|
||||
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true );
|
||||
if( m_font ) ImGui::PushFont( m_font );
|
||||
if( m_showAsm )
|
||||
@ -290,7 +291,7 @@ void SourceView::Render( const Worker& worker )
|
||||
m_targetAddr = 0;
|
||||
ImGui::SetScrollHereY();
|
||||
}
|
||||
RenderAsmLine( line, 0, iptotal, worker );
|
||||
RenderAsmLine( line, 0, iptotal, worker, jumpOut );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -302,7 +303,7 @@ void SourceView::Render( const Worker& worker )
|
||||
{
|
||||
for( auto i=clipper.DisplayStart; i<clipper.DisplayEnd; i++ )
|
||||
{
|
||||
RenderAsmLine( m_asm[i], 0, 0, worker );
|
||||
RenderAsmLine( m_asm[i], 0, 0, worker, jumpOut );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -312,7 +313,7 @@ void SourceView::Render( const Worker& worker )
|
||||
auto& line = m_asm[i];
|
||||
auto it = ipcount.find( line.addr );
|
||||
const auto ipcnt = it == ipcount.end() ? 0 : it->second;
|
||||
RenderAsmLine( line, ipcnt, iptotal, worker );
|
||||
RenderAsmLine( line, ipcnt, iptotal, worker, jumpOut );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -359,6 +360,15 @@ void SourceView::Render( const Worker& worker )
|
||||
}
|
||||
if( m_font ) ImGui::PopFont();
|
||||
ImGui::EndChild();
|
||||
|
||||
if( jumpOut != 0 )
|
||||
{
|
||||
auto sym = worker.GetSymbolData( jumpOut );
|
||||
if( sym )
|
||||
{
|
||||
Open( worker.GetString( sym->file ), sym->line, jumpOut, jumpOut, worker );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal )
|
||||
@ -405,7 +415,7 @@ void SourceView::RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint
|
||||
draw->AddLine( wpos + ImVec2( 0, ty+2 ), wpos + ImVec2( w, ty+2 ), 0x08FFFFFF );
|
||||
}
|
||||
|
||||
void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker )
|
||||
void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut )
|
||||
{
|
||||
const auto ty = ImGui::GetFontSize();
|
||||
auto draw = ImGui::GetWindowDrawList();
|
||||
@ -481,6 +491,7 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
|
||||
else
|
||||
{
|
||||
ImGui::TextDisabled( "[%s+%" PRIu32"]", worker.GetString( sym->name ), offset );
|
||||
if( ImGui::IsItemClicked() ) jumpOut = line.jumpAddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
|
||||
private:
|
||||
void RenderLine( const Line& line, int lineNum, uint32_t ipcnt, uint32_t iptotal );
|
||||
void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker );
|
||||
void RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t iptotal, const Worker& worker, uint64_t& jumpOut );
|
||||
|
||||
bool Disassemble( uint64_t symAddr, const Worker& worker );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user