Differentiate between symbol and base address.

This commit is contained in:
Bartosz Taudul 2020-03-27 17:59:16 +01:00
parent 992f4c8c2d
commit 720ed0460b
4 changed files with 9 additions and 6 deletions

View File

@ -33,11 +33,12 @@ SourceView::~SourceView()
delete[] m_data;
}
void SourceView::Open( const char* fileName, int line, uint64_t symAddr, const Worker& worker )
void SourceView::Open( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr, const Worker& worker )
{
m_targetLine = line;
m_selectedLine = line;
m_targetAddr = symAddr;
m_baseAddr = baseAddr;
m_symAddr = symAddr;
if( m_file != fileName )
@ -83,7 +84,7 @@ void SourceView::Open( const char* fileName, int line, uint64_t symAddr, const W
}
if( m_lines.empty() ) m_showAsm = true;
if( !Disassemble( symAddr, worker ) ) m_showAsm = false;
if( !Disassemble( baseAddr, worker ) ) m_showAsm = false;
assert( m_showAsm || !m_lines.empty() );
}

View File

@ -27,7 +27,7 @@ public:
SourceView( ImFont* font );
~SourceView();
void Open( const char* fileName, int line, uint64_t symAddr, const Worker& worker );
void Open( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr, const Worker& worker );
void Render( const Worker& worker );
private:
@ -39,6 +39,7 @@ private:
ImFont* m_font;
const char* m_file;
uint64_t m_symAddr;
uint64_t m_baseAddr;
uint64_t m_targetAddr;
char* m_data;
size_t m_dataSize;

View File

@ -192,11 +192,11 @@ void View::InitTextEditor( ImFont* font )
m_sourceViewFile = nullptr;
}
void View::SetTextEditorFile( const char* fileName, int line, uint64_t symAddr )
void View::SetTextEditorFile( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr )
{
assert( fileName || symAddr );
m_sourceViewFile = fileName ? fileName : (const char*)~uint64_t( 0 );
m_sourceView->Open( fileName, line, symAddr, m_worker );
m_sourceView->Open( fileName, line, baseAddr, symAddr, m_worker );
}
const char* View::ShortenNamespace( const char* name ) const

View File

@ -80,7 +80,8 @@ public:
static bool Draw();
void NotifyRootWindowSize( float w, float h ) { m_rootWidth = w; m_rootHeight = h; }
void SetTextEditorFile( const char* fileName, int line, uint64_t symAddr );
void SetTextEditorFile( const char* fileName, int line, uint64_t baseAddr, uint64_t symAddr );
void SetTextEditorFile( const char* fileName, int line, uint64_t symAddr ) { SetTextEditorFile( fileName, line, symAddr, symAddr ); }
bool ReconnectRequested() const { return m_reconnectRequested; }
std::string GetAddress() const { return m_worker.GetAddr(); }