diff --git a/src/platform/qt/MemoryModel.h b/src/platform/qt/MemoryModel.h index f1f46f406..972a1c7b2 100644 --- a/src/platform/qt/MemoryModel.h +++ b/src/platform/qt/MemoryModel.h @@ -32,6 +32,9 @@ public: void setAlignment(int); int alignment() const { return m_align; } + QByteArray serialize(); + void deserialize(const QByteArray&); + public slots: void jumpToAddress(const QString& hex); void jumpToAddress(uint32_t); @@ -61,9 +64,6 @@ private: void adjustCursor(int adjust, bool shift); - QByteArray serialize(); - void deserialize(const QByteArray&); - mCore* m_core; QFont m_font; int m_cellHeight; diff --git a/src/platform/qt/MemoryView.cpp b/src/platform/qt/MemoryView.cpp index 92e971768..ca5e5e32b 100644 --- a/src/platform/qt/MemoryView.cpp +++ b/src/platform/qt/MemoryView.cpp @@ -167,15 +167,25 @@ void MemoryView::updateSelection(uint32_t start, uint32_t end) { void MemoryView::updateStatus() { int align = m_ui.hexfield->alignment(); + if (!m_controller->isLoaded()) { + return; + } + mCore* core = m_controller->thread()->core; + QByteArray selection(m_ui.hexfield->serialize()); + QString text; + for (QChar c : selection) { + if (!c.isPrint() || c >= 127) { + continue; + } + text.append(c); + } + m_ui.stringVal->setText(text); + if (m_selection.first & (align - 1) || m_selection.second - m_selection.first != align) { m_ui.sintVal->clear(); m_ui.uintVal->clear(); return; } - if (!m_controller->isLoaded()) { - return; - } - mCore* core = m_controller->thread()->core; union { uint32_t u32; int32_t i32; diff --git a/src/platform/qt/MemoryView.ui b/src/platform/qt/MemoryView.ui index 45bf326bb..cb6a67141 100644 --- a/src/platform/qt/MemoryView.ui +++ b/src/platform/qt/MemoryView.ui @@ -6,8 +6,8 @@ 0 0 - 550 - 640 + 565 + 658 @@ -168,20 +168,39 @@ 0 + - - - - + + + + + + + Unsigned Integer: + + + + + + + true + + + + + + + + Signed Integer: - + true @@ -190,17 +209,17 @@ - - - - + + + + - Unsigned Integer: + String: - - + + true