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

Filter invalid jumps.

This commit is contained in:
Bartosz Taudul 2020-04-19 15:45:19 +02:00
parent ea00efa857
commit 421f0895b7

View File

@ -223,18 +223,26 @@ bool SourceView::Disassemble( uint64_t symAddr, const Worker& worker )
} }
if( jumpAddr >= symAddr && jumpAddr < symAddr + len ) if( jumpAddr >= symAddr && jumpAddr < symAddr + len )
{ {
const auto min = std::min( jumpAddr, op.address ); auto fit = std::lower_bound( insn, insn+cnt, jumpAddr, []( const auto& l, const auto& r ) { return l.address < r; } );
const auto max = std::max( jumpAddr, op.address ); if( fit != insn+cnt && fit->address == jumpAddr )
auto it = m_jumpTable.find( jumpAddr );
if( it == m_jumpTable.end() )
{ {
m_jumpTable.emplace( jumpAddr, JumpData { min, max, 0, { op.address } } ); const auto min = std::min( jumpAddr, op.address );
const auto max = std::max( jumpAddr, op.address );
auto it = m_jumpTable.find( jumpAddr );
if( it == m_jumpTable.end() )
{
m_jumpTable.emplace( jumpAddr, JumpData { min, max, 0, { op.address } } );
}
else
{
if( it->second.min > min ) it->second.min = min;
else if( it->second.max < max ) it->second.max = max;
it->second.source.emplace_back( op.address );
}
} }
else else
{ {
if( it->second.min > min ) it->second.min = min; jumpAddr = 0;
else if( it->second.max < max ) it->second.max = max;
it->second.source.emplace_back( op.address );
} }
} }
else else