mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 16:40:42 +08:00
Image viewer in Memory Visualizer. (First pass - slow).
This commit is contained in:
@@ -17,6 +17,7 @@ SeerMemoryVisualizerWidget::SeerMemoryVisualizerWidget (QWidget* parent) : QWidg
|
||||
_variableId = Seer::createID(); // Create two id's for queries.
|
||||
_memoryId = Seer::createID();
|
||||
_asmId = Seer::createID();
|
||||
_imageId = Seer::createID();
|
||||
|
||||
// Set up UI.
|
||||
setupUi(this);
|
||||
@@ -83,6 +84,8 @@ void SeerMemoryVisualizerWidget::setVariableName (const QString& name) {
|
||||
QByteArray array;
|
||||
|
||||
memoryHexEditor->setData(new SeerHexWidget::DataStorageArray(array));
|
||||
memoryAsmEditor->setData("");
|
||||
memoryImageEditor->setData(array);
|
||||
|
||||
// Send signal to get variable address.
|
||||
emit evaluateVariableExpression(_variableId, variableNameLineEdit->text());
|
||||
@@ -138,11 +141,14 @@ void SeerMemoryVisualizerWidget::setVariableAddress (const QString& address) {
|
||||
}
|
||||
|
||||
QString SeerMemoryVisualizerWidget::variableAddress () const {
|
||||
|
||||
return variableAddressLineEdit->text();
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::handleText (const QString& text) {
|
||||
|
||||
QApplication::setOverrideCursor(Qt::BusyCursor);
|
||||
|
||||
//qDebug() << text;
|
||||
|
||||
if (text.contains(QRegExp("^([0-9]+)\\^done,value="))) {
|
||||
@@ -183,8 +189,6 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) {
|
||||
|
||||
QString contents_text = Seer::parseFirst(range_text, "contents=", '"', '"', false);
|
||||
|
||||
//qDebug() << contents_text;
|
||||
|
||||
// Convert hex string to byte array.
|
||||
QByteArray array;
|
||||
|
||||
@@ -198,6 +202,35 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) {
|
||||
// Give the byte array to the hex widget.
|
||||
memoryHexEditor->setData(new SeerHexWidget::DataStorageArray(array));
|
||||
|
||||
break; // Take just the first range for now.
|
||||
}
|
||||
|
||||
}else if (id_text.toInt() == _imageId) {
|
||||
|
||||
//qDebug() << text;
|
||||
|
||||
QString memory_text = Seer::parseFirst(text, "memory=", '[', ']', false);
|
||||
|
||||
QStringList range_list = Seer::parse(memory_text, "", '{', '}', false);
|
||||
|
||||
// Loop through the memory ranges.
|
||||
for ( const auto& range_text : range_list ) {
|
||||
|
||||
QString contents_text = Seer::parseFirst(range_text, "contents=", '"', '"', false);
|
||||
|
||||
// Convert hex string to byte array.
|
||||
QByteArray array;
|
||||
|
||||
for (int i = 0; i<contents_text.size(); i += 2) {
|
||||
QString num = contents_text.mid(i, 2);
|
||||
bool ok = false;
|
||||
array.push_back(num.toInt(&ok, 16));
|
||||
Q_ASSERT(ok);
|
||||
}
|
||||
|
||||
// Give the byte array to the image widget.
|
||||
memoryImageEditor->setData(array);
|
||||
|
||||
break; // Take just the first range for now.
|
||||
}
|
||||
}
|
||||
@@ -242,6 +275,8 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) {
|
||||
}else{
|
||||
// Ignore anything else.
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::handleRefreshButton () {
|
||||
@@ -265,7 +300,8 @@ void SeerMemoryVisualizerWidget::handleRefreshButton () {
|
||||
}
|
||||
|
||||
emit evaluateMemoryExpression(_memoryId, variableAddressLineEdit->text(), nbytes);
|
||||
emit evaluateAsmExpression(_asmId, variableAddressLineEdit->text(), nbytes, 2);
|
||||
emit evaluateAsmExpression(_asmId, variableAddressLineEdit->text(), nbytes, 2);
|
||||
emit evaluateMemoryExpression(_imageId, variableAddressLineEdit->text(), nbytes);
|
||||
}
|
||||
|
||||
void SeerMemoryVisualizerWidget::handleHelpButton () {
|
||||
|
||||
Reference in New Issue
Block a user