Add source file location tooltip for assembly instructions.

This has bad UX, better solution is needed.
This commit is contained in:
Bartosz Taudul 2020-04-02 00:39:17 +02:00
parent d204742bb8
commit 327e30fe7c

View File

@ -497,6 +497,19 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
memset( buf+asz, ' ', 16-asz ); memset( buf+asz, ' ', 16-asz );
buf[16] = '\0'; buf[16] = '\0';
TextDisabledUnformatted( buf ); TextDisabledUnformatted( buf );
if( ImGui::IsItemHovered() )
{
uint32_t srcline;
const auto idx = worker.GetLocationForAddress( line.addr, srcline );
if( srcline != 0 )
{
if( m_font ) ImGui::PopFont();
ImGui::BeginTooltip();
ImGui::Text( "%s:%i", worker.GetString( idx ), srcline );
ImGui::EndTooltip();
if( m_font ) ImGui::PushFont( m_font );
}
}
ImGui::SameLine( 0, ty ); ImGui::SameLine( 0, ty );
const auto msz = line.mnemonic.size(); const auto msz = line.mnemonic.size();