1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Assembly addresses can be displayed relative to symbol.

This commit is contained in:
Bartosz Taudul 2020-03-28 14:33:35 +01:00
parent 9837e06816
commit 78eb774822
2 changed files with 14 additions and 1 deletions

View File

@ -27,6 +27,7 @@ SourceView::SourceView( ImFont* font )
, m_showAsm( false )
, m_codeLen( 0 )
, m_highlightAddr( 0 )
, m_asmRelative( false )
{
}
@ -276,6 +277,10 @@ void SourceView::Render( const Worker& worker )
ImGui::SameLine();
TextColoredUnformatted( ImVec4( 1.f, 1.f, 0.2f, 1.f ), ICON_FA_EXCLAMATION_TRIANGLE );
}
else
{
SmallCheckbox( ICON_FA_SEARCH_LOCATION " Relative locations", &m_asmRelative );
}
uint64_t jumpOut = 0;
ImGui::BeginChild( "##sourceView", ImVec2( 0, 0 ), true );
@ -452,7 +457,14 @@ void SourceView::RenderAsmLine( const AsmLine& line, uint32_t ipcnt, uint32_t ip
}
char buf[256];
sprintf( buf, "%" PRIx64, line.addr );
if( m_asmRelative )
{
sprintf( buf, "+%" PRIu64, line.addr - m_baseAddr );
}
else
{
sprintf( buf, "%" PRIx64, line.addr );
}
const auto asz = strlen( buf );
memset( buf+asz, ' ', 16-asz );
buf[16] = '\0';

View File

@ -52,6 +52,7 @@ private:
bool m_showAsm;
uint32_t m_codeLen;
DecayValue<uint64_t> m_highlightAddr;
bool m_asmRelative;
std::vector<Line> m_lines;
std::vector<AsmLine> m_asm;