Refactor SymbolNavigator for 64-bit
MODIFY
src/edittab.cpp
src/edittab.cpp
@@ -110,11 +110,13 @@ EditTab::EditTab(QToolBar* toolbar, QWidget* parent) : RipesTab(toolbar, parent)
}
void EditTab::showSymbolNavigator() {
- SymbolNavigator nav(m_ui->programViewer->addressOffsetMap(), this);
+ if (auto program = ProcessorHandler::getProgram()) {
+ SymbolNavigator nav(program->symbols, this);
if (nav.exec()) {
m_ui->programViewer->setCenterAddress(nav.getSelectedSymbolAddress());
}
}
+}
void EditTab::loadExternalFile(const LoadFileParams& params) {
if (params.type == SourceType::C) {

MODIFY
src/symbolnavigator.cpp
src/symbolnavigator.cpp
namespace Ripes {
-SymbolNavigator::SymbolNavigator(const Assembler::AddrOffsetMap& symbolmap, QWidget* parent)
+SymbolNavigator::SymbolNavigator(const ReverseSymbolMap& symbolmap, QWidget* parent)
: QDialog(parent), m_ui(new Ui::SymbolNavigator) {
m_ui->setupUi(this);
@@ -20,19 +20,16 @@ SymbolNavigator::SymbolNavigator(const Assembler::AddrOffsetMap& symbolmap, QWid
m_ui->symbolTable->verticalHeader()->hide();
m_ui->symbolTable->setHorizontalHeaderLabels({"Address", "Label"});
m_ui->symbolTable->horizontalHeader()->setStretchLastSection(true);
+ m_ui->symbolTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Go to symbol");
for (const auto& iter : symbolmap) {
- if (!iter.second.second.isEmpty()) {
- const long address = (iter.first - iter.second.first) * ProcessorHandler::currentISA()->bytes() +
- ProcessorHandler::getTextStart();
- addSymbol(address, iter.second.second);
- }
+ addSymbol(iter.first, iter.second);
}
m_ui->symbolTable->selectRow(0);
}
-long SymbolNavigator::getSelectedSymbolAddress() const {
+AInt SymbolNavigator::getSelectedSymbolAddress() const {
const auto selected = m_ui->symbolTable->selectedItems();
if (selected.size() > 0) {
return selected[0]->data(Qt::UserRole).toUInt();

MODIFY
src/symbolnavigator.h
src/symbolnavigator.h
@@ -14,10 +14,10 @@ class SymbolNavigator : public QDialog {
Q_OBJECT
public:
- SymbolNavigator(const Assembler::AddrOffsetMap& symbolmap, QWidget* parent = nullptr);
+ SymbolNavigator(const ReverseSymbolMap& symbolmap, QWidget* parent = nullptr);
~SymbolNavigator();
- long getSelectedSymbolAddress() const;
+ AInt getSelectedSymbolAddress() const;
private:
void addSymbol(const AInt address, const QString& label);

Refactor SymbolNavigator for 64-bit