mirror of
https://github.com/wolfpld/tracy.git
synced 2024-12-01 17:34:36 +00:00
Add local call stack navigation menu to asm lines.
This commit is contained in:
parent
0f283d5825
commit
a226446a92
@ -2807,6 +2807,60 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
|
|||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
if( ImGui::BeginPopup( "localCallstackPopup" ) )
|
||||||
|
{
|
||||||
|
const auto lcs = m_localCallstackPopup;
|
||||||
|
for( uint8_t i=0; i<lcs->size; i++ )
|
||||||
|
{
|
||||||
|
ImGui::PushID( i );
|
||||||
|
ImGui::TextDisabled( "%i.", i+1 );
|
||||||
|
ImGui::SameLine();
|
||||||
|
const auto symName = worker.GetString( lcs->data[i].name );
|
||||||
|
const auto normalized = view.GetShortenName() != ShortenName::Never ? ShortenZoneName( ShortenName::OnlyNormalize, symName ) : symName;
|
||||||
|
const auto fn = worker.GetString( lcs->data[i].file );
|
||||||
|
const auto srcline = lcs->data[i].line;
|
||||||
|
if( ImGui::Selectable( normalized ) )
|
||||||
|
{
|
||||||
|
m_targetLine = srcline;
|
||||||
|
if( m_source.filename() == fn )
|
||||||
|
{
|
||||||
|
SelectLine( srcline, &worker, false );
|
||||||
|
m_displayMode = DisplayMixed;
|
||||||
|
}
|
||||||
|
else if( SourceFileValid( fn, worker.GetCaptureTime(), view, worker ) )
|
||||||
|
{
|
||||||
|
ParseSource( fn, worker, view );
|
||||||
|
SelectLine( srcline, &worker, false );
|
||||||
|
SelectViewMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( ImGui::IsItemHovered() )
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
if( SourceFileValid( fn, worker.GetCaptureTime(), view, worker ) )
|
||||||
|
{
|
||||||
|
m_sourceTooltip.Parse( fn, worker, view );
|
||||||
|
if( !m_sourceTooltip.empty() )
|
||||||
|
{
|
||||||
|
ImGui::PushFont( m_smallFont );
|
||||||
|
ImGui::TextDisabled( "%s:%i", fn, srcline );
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::Separator();
|
||||||
|
SetFont();
|
||||||
|
PrintSourceFragment( m_sourceTooltip, srcline );
|
||||||
|
UnsetFont();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( "Source not available" );
|
||||||
|
}
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
SetFont();
|
SetFont();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3790,18 +3844,17 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
|
|||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
SetFont();
|
SetFont();
|
||||||
if( ImGui::IsItemClicked( 0 ) || ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 0 ) )
|
||||||
{
|
{
|
||||||
|
m_targetLine = srcline;
|
||||||
if( m_source.filename() == fileName )
|
if( m_source.filename() == fileName )
|
||||||
{
|
{
|
||||||
if( ImGui::IsMouseClicked( 0 ) ) m_targetLine = srcline;
|
|
||||||
SelectLine( srcline, &worker, false );
|
SelectLine( srcline, &worker, false );
|
||||||
m_displayMode = DisplayMixed;
|
m_displayMode = DisplayMixed;
|
||||||
}
|
}
|
||||||
else if( SourceFileValid( fileName, worker.GetCaptureTime(), view, worker ) )
|
else if( SourceFileValid( fileName, worker.GetCaptureTime(), view, worker ) )
|
||||||
{
|
{
|
||||||
ParseSource( fileName, worker, view );
|
ParseSource( fileName, worker, view );
|
||||||
m_targetLine = srcline;
|
|
||||||
SelectLine( srcline, &worker, false );
|
SelectLine( srcline, &worker, false );
|
||||||
SelectViewMode();
|
SelectViewMode();
|
||||||
}
|
}
|
||||||
@ -3813,6 +3866,13 @@ void SourceView::RenderAsmLine( AsmLine& line, const AddrStat& ipcnt, const Addr
|
|||||||
m_hoveredLine = srcline;
|
m_hoveredLine = srcline;
|
||||||
m_hoveredSource = srcidx.Idx();
|
m_hoveredSource = srcidx.Idx();
|
||||||
}
|
}
|
||||||
|
if( frame && frame->data[0].name.Active() && ImGui::IsItemClicked( 1 ) )
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup( "localCallstackPopup" );
|
||||||
|
m_localCallstackPopup = frame;
|
||||||
|
m_selectedAddresses.clear();
|
||||||
|
m_selectedAddresses.emplace( line.addr );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -21,6 +21,7 @@ namespace tracy
|
|||||||
|
|
||||||
class View;
|
class View;
|
||||||
class Worker;
|
class Worker;
|
||||||
|
struct CallstackFrameData;
|
||||||
|
|
||||||
class SourceView
|
class SourceView
|
||||||
{
|
{
|
||||||
@ -234,6 +235,7 @@ private:
|
|||||||
uint8_t m_maxAsmBytes;
|
uint8_t m_maxAsmBytes;
|
||||||
bool m_atnt;
|
bool m_atnt;
|
||||||
uint64_t m_jumpPopupAddr;
|
uint64_t m_jumpPopupAddr;
|
||||||
|
const CallstackFrameData* m_localCallstackPopup;
|
||||||
bool m_hwSamples, m_hwSamplesRelative;
|
bool m_hwSamples, m_hwSamplesRelative;
|
||||||
bool m_childCalls;
|
bool m_childCalls;
|
||||||
bool m_childCallList;
|
bool m_childCallList;
|
||||||
|
Loading…
Reference in New Issue
Block a user