diff --git a/src/platform/qt/MemoryModel.cpp b/src/platform/qt/MemoryModel.cpp index e2ad0700a..dfdc6c113 100644 --- a/src/platform/qt/MemoryModel.cpp +++ b/src/platform/qt/MemoryModel.cpp @@ -149,12 +149,6 @@ void MemoryModel::jumpToAddress(const QString& hex) { } void MemoryModel::jumpToAddress(uint32_t address) { - if (address >= 0x10000000) { - return; - } - if (address < m_base || address >= m_base + m_size) { - setRegion(0, 0x10000000, tr("All")); - } m_top = (address - m_base) / 16; boundsCheck(); verticalScrollBar()->setValue(m_top); diff --git a/src/platform/qt/MemoryView.cpp b/src/platform/qt/MemoryView.cpp index 9b91d8180..4d6827326 100644 --- a/src/platform/qt/MemoryView.cpp +++ b/src/platform/qt/MemoryView.cpp @@ -42,7 +42,7 @@ MemoryView::MemoryView(std::shared_ptr controller, QWidget* pare connect(m_ui.width16, &QAbstractButton::clicked, [this]() { m_ui.hexfield->setAlignment(2); }); connect(m_ui.width32, &QAbstractButton::clicked, [this]() { m_ui.hexfield->setAlignment(4); }); connect(m_ui.setAddress, static_cast(&QSpinBox::valueChanged), - m_ui.hexfield, static_cast(&MemoryModel::jumpToAddress)); + this, static_cast(&MemoryView::jumpToAddress)); connect(m_ui.hexfield, &MemoryModel::selectionChanged, this, &MemoryView::updateSelection); connect(controller.get(), &CoreController::stopping, this, &QWidget::close); @@ -66,6 +66,7 @@ void MemoryView::setIndex(int index) { size_t nBlocks = core->listMemoryBlocks(core, &blocks); const mCoreMemoryBlock& info = blocks[index]; + m_region = qMakePair(info.start, info.end); m_ui.segments->setValue(-1); m_ui.segments->setVisible(info.maxSegment > 0); m_ui.segments->setMaximum(info.maxSegment); @@ -86,6 +87,17 @@ void MemoryView::update() { updateStatus(); } +void MemoryView::jumpToAddress(uint32_t address) { + if (address < m_region.first || address >= m_region.second) { + m_ui.regions->setCurrentIndex(0); + setIndex(0); + } + if (address < m_region.first || address >= m_region.second) { + return; + } + m_ui.hexfield->jumpToAddress(address); +} + void MemoryView::updateSelection(uint32_t start, uint32_t end) { m_selection.first = start; m_selection.second = end; diff --git a/src/platform/qt/MemoryView.h b/src/platform/qt/MemoryView.h index 3af1835b8..bc276af35 100644 --- a/src/platform/qt/MemoryView.h +++ b/src/platform/qt/MemoryView.h @@ -21,7 +21,7 @@ public: public slots: void update(); - void jumpToAddress(uint32_t address) { m_ui.hexfield->jumpToAddress(address); } + void jumpToAddress(uint32_t address); private slots: void setIndex(int); @@ -33,6 +33,7 @@ private: Ui::MemoryView m_ui; std::shared_ptr m_controller; + QPair m_region; QPair m_selection; };