Display jump target even if there's no source location.

This commit is contained in:
Bartosz Taudul 2022-08-14 14:01:01 +02:00
parent 99a110d5b1
commit e289884395
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -2622,17 +2622,32 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
{
uint32_t srcline;
const auto srcidx = worker.GetLocationForAddress( m_jumpPopupAddr, srcline );
if( srcline != 0 )
{
const auto fileName = worker.GetString( srcidx );
const auto fileColor = GetHsvColor( srcidx.Idx(), 0 );
const auto fileName = srcline != 0 ? worker.GetString( srcidx ) : nullptr;
const auto fileColor = srcline != 0 ? GetHsvColor( srcidx.Idx(), 0 ) : 0;
SmallColorBox( fileColor );
ImGui::SameLine();
char buf[1024];
if( fileName )
{
snprintf( buf, 1024, "%s:%i", fileName, srcline );
}
else
{
uint32_t jumpOffset = 0;
uint64_t jumpBase = worker.GetSymbolForAddress( m_jumpPopupAddr, jumpOffset );
auto jumpSym = jumpBase == 0 ? worker.GetSymbolData( m_jumpPopupAddr ) : worker.GetSymbolData( jumpBase );
if( jumpSym )
{
snprintf( buf, 1024, "%s+%" PRIu32, worker.GetString( jumpSym->name ), jumpOffset );
}
else
{
ImGui::TextDisabled( "0x%" PRIx64, m_jumpPopupAddr );
}
}
if( ImGui::BeginMenu( buf ) )
{
if( SourceFileValid( fileName, worker.GetCaptureTime(), view, worker ) )
if( fileName && SourceFileValid( fileName, worker.GetCaptureTime(), view, worker ) )
{
m_sourceTooltip.Parse( fileName, worker, view );
if( !m_sourceTooltip.empty() )
@ -2654,7 +2669,6 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
m_selectedAddresses.emplace( m_jumpPopupAddr );
}
}
}
ImGui::EndMenu();
}
ImGui::EndPopup();