mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Add PC, SP, FLAGS status bar to Assembly tab.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
* Remove whitespace from C/C++ lines in the Assembly tab.
|
||||
* Allow assembly code to have its own font format. See Config->Editor->AssemblyText.
|
||||
* Add Nexti and Stepi toolbar buttons if Assembly tab is shown.
|
||||
* Add PC, SP, FLAGS status bar to Assembly tab.
|
||||
|
||||
## [1.13] - 2022-12-02
|
||||
|
||||
|
||||
@@ -151,6 +151,7 @@ void SeerEditorManagerWidget::showAssembly () {
|
||||
}
|
||||
|
||||
assemblyWidgetTab()->assemblyArea()->setAddress("$pc");
|
||||
assemblyWidgetTab()->reloadRegisters();
|
||||
}
|
||||
|
||||
SeerEditorWidgetAssembly* SeerEditorManagerWidget::assemblyWidgetTab () {
|
||||
@@ -445,6 +446,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
|
||||
|
||||
if (assemblyWidget) {
|
||||
assemblyWidget->assemblyArea()->handleText(text);
|
||||
assemblyWidget->handleText(text);
|
||||
}
|
||||
|
||||
// Handle certain reasons uniquely.
|
||||
@@ -584,6 +586,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
|
||||
|
||||
if (assemblyWidget) {
|
||||
assemblyWidget->assemblyArea()->handleText(text);
|
||||
assemblyWidget->handleText(text);
|
||||
}
|
||||
|
||||
}else if (text.startsWith("^done,asm_insns=")) {
|
||||
@@ -593,6 +596,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
|
||||
|
||||
if (assemblyWidget) {
|
||||
assemblyWidget->assemblyArea()->handleText(text);
|
||||
assemblyWidget->handleText(text);
|
||||
}
|
||||
|
||||
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
|
||||
@@ -619,6 +623,13 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
|
||||
static_cast<SeerEditorWidgetSource*>(w)->sourceArea()->handleText(text);
|
||||
}
|
||||
|
||||
SeerEditorWidgetAssembly* assemblyWidget = assemblyWidgetTab();
|
||||
|
||||
if (assemblyWidget) {
|
||||
assemblyWidget->assemblyArea()->handleText(text);
|
||||
assemblyWidget->handleText(text);
|
||||
}
|
||||
|
||||
}else if (text.contains(QRegExp("^([0-9]+)\\^error,msg="))) {
|
||||
|
||||
// 12^error,msg="No symbol \"return\" in current context."
|
||||
@@ -940,6 +951,7 @@ SeerEditorWidgetAssembly* SeerEditorManagerWidget::createAssemblyWidgetTab () {
|
||||
QObject::connect(assemblyWidget->assemblyArea(), &SeerEditorWidgetAssemblyArea::addMemoryVisualize, this, &SeerEditorManagerWidget::handleAddMemoryVisualizer);
|
||||
QObject::connect(assemblyWidget->assemblyArea(), &SeerEditorWidgetAssemblyArea::addArrayVisualize, this, &SeerEditorManagerWidget::handleAddArrayVisualizer);
|
||||
QObject::connect(assemblyWidget->assemblyArea(), &SeerEditorWidgetAssemblyArea::addStructVisualize, this, &SeerEditorManagerWidget::handleAddStructVisualizer);
|
||||
QObject::connect(assemblyWidget, &SeerEditorWidgetAssembly::evaluateVariableExpression, this, &SeerEditorManagerWidget::handleEvaluateVariableExpression);
|
||||
|
||||
// Load the file.
|
||||
assemblyWidget->assemblyArea()->setPlainText("");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "SeerEditorWidgetAssembly.h"
|
||||
#include "SeerUtl.h"
|
||||
#include <QtGui/QColor>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QTextBlock>
|
||||
@@ -35,6 +36,15 @@ SeerEditorWidgetAssembly::SeerEditorWidgetAssembly(QWidget* parent) : QWidget(pa
|
||||
|
||||
setKeySettings(SeerKeySettings::populate());
|
||||
|
||||
_pcId = Seer::createID();
|
||||
_spId = Seer::createID();
|
||||
_flagsId = Seer::createID();
|
||||
|
||||
// Clear PC, SP, and FLAGS.
|
||||
pcLineEdit->clear();
|
||||
spLineEdit->clear();
|
||||
flagsLineEdit->clear();
|
||||
|
||||
// Connect things.
|
||||
QObject::connect(searchTextLineEdit, &QLineEdit::returnPressed, this, &SeerEditorWidgetAssembly::handleSearchTextLineEdit);
|
||||
QObject::connect(matchCaseCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetAssembly::handleSearchTextLineEdit);
|
||||
@@ -43,6 +53,7 @@ SeerEditorWidgetAssembly::SeerEditorWidgetAssembly(QWidget* parent) : QWidget(pa
|
||||
QObject::connect(searchLineNumberLineEdit, &QLineEdit::returnPressed, this, &SeerEditorWidgetAssembly::handleSearchLineNumberLineEdit);
|
||||
QObject::connect(searchCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::handleSearchCloseToolButton);
|
||||
QObject::connect(refreshToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::reloadAssembly);
|
||||
QObject::connect(refreshToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::reloadRegisters);
|
||||
QObject::connect(showAddressCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetAssembly::handleShowAddressColumn);
|
||||
QObject::connect(showOffsetCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetAssembly::handleShowOffsetColumn);
|
||||
QObject::connect(showOpcodeCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetAssembly::handleShowOpcodeColumn);
|
||||
@@ -125,6 +136,19 @@ void SeerEditorWidgetAssembly::reloadAssembly () {
|
||||
QString addr = assemblyArea()->address();
|
||||
|
||||
assemblyArea()->setAddress(addr, true);
|
||||
|
||||
// Get the PC, SP, and FLAGS
|
||||
emit evaluateVariableExpression(_pcId, "$pc");
|
||||
emit evaluateVariableExpression(_spId, "$sp");
|
||||
emit evaluateVariableExpression(_flagsId, "$ps");
|
||||
}
|
||||
|
||||
void SeerEditorWidgetAssembly::reloadRegisters () {
|
||||
|
||||
// Get the PC, SP, and FLAGS
|
||||
emit evaluateVariableExpression(_pcId, "$pc");
|
||||
emit evaluateVariableExpression(_spId, "$sp");
|
||||
emit evaluateVariableExpression(_flagsId, "$ps");
|
||||
}
|
||||
|
||||
void SeerEditorWidgetAssembly::showSearchBar (bool flag) {
|
||||
@@ -170,6 +194,95 @@ void SeerEditorWidgetAssembly::setShowSourceLines (bool flag) {
|
||||
handleShowSourceLines();
|
||||
}
|
||||
|
||||
void SeerEditorWidgetAssembly::handleText (const QString& text) {
|
||||
|
||||
if (text.startsWith("*stopped")) {
|
||||
|
||||
//qDebug() << text;
|
||||
|
||||
// *stopped,
|
||||
//
|
||||
// reason="end-stepping-range",
|
||||
//
|
||||
// frame={addr="0x0000000000400b45",
|
||||
// func="main",
|
||||
// args=[{name="argc",value="1"},{name="argv",value="0x7fffffffd5b8"}],
|
||||
// file="helloworld.cpp",
|
||||
// fullname="/home/erniep/Development/Peak/src/Seer/helloworld/helloworld.cpp",
|
||||
// line="7",
|
||||
// arch="i386:x86-64"},
|
||||
//
|
||||
// thread-id="1",
|
||||
// stopped-threads="all",
|
||||
// core="6"
|
||||
|
||||
QString newtext = Seer::filterEscapes(text); // Filter escaped characters.
|
||||
|
||||
QString frame_text = Seer::parseFirst(newtext, "frame=", '{', '}', false);
|
||||
|
||||
if (frame_text == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the PC, SP, and FLAGS
|
||||
emit evaluateVariableExpression(_pcId, "$pc");
|
||||
emit evaluateVariableExpression(_spId, "$sp");
|
||||
emit evaluateVariableExpression(_flagsId, "$ps");
|
||||
|
||||
return;
|
||||
|
||||
}else if (text.contains(QRegExp("^([0-9]+)\\^done,value="))) {
|
||||
|
||||
QString id_text = text.section('^', 0,0);
|
||||
QString value_text = Seer::parseFirst(text, "value=", '"', '"', false);
|
||||
|
||||
if (id_text == QString::number(_pcId)) {
|
||||
pcLineEdit->setText(Seer::filterEscapes(value_text));
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_text == QString::number(_spId)) {
|
||||
spLineEdit->setText(Seer::filterEscapes(value_text));
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_text == QString::number(_flagsId)) {
|
||||
flagsLineEdit->setText(Seer::filterEscapes(value_text));
|
||||
return;
|
||||
}
|
||||
|
||||
}else if (text.contains(QRegExp("^([0-9]+)\\^error,msg="))) {
|
||||
|
||||
QString id_text = text.section('^', 0,0);
|
||||
QString msg_text = Seer::parseFirst(text, "value=", '"', '"', false);
|
||||
|
||||
if (id_text == QString::number(_pcId)) {
|
||||
pcLineEdit->setText(Seer::filterEscapes(msg_text));
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_text == QString::number(_spId)) {
|
||||
spLineEdit->setText(Seer::filterEscapes(msg_text));
|
||||
return;
|
||||
}
|
||||
|
||||
if (id_text == QString::number(_flagsId)) {
|
||||
flagsLineEdit->setText(Seer::filterEscapes(msg_text));
|
||||
return;
|
||||
}
|
||||
|
||||
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
|
||||
|
||||
// Clear PC, SP, and FLAGS.
|
||||
pcLineEdit->clear();
|
||||
spLineEdit->clear();
|
||||
flagsLineEdit->clear();
|
||||
|
||||
}else{
|
||||
// Ignore others.
|
||||
}
|
||||
}
|
||||
|
||||
void SeerEditorWidgetAssembly::handleSearchLineNumberLineEdit () {
|
||||
|
||||
QString address = searchLineNumberLineEdit->text();
|
||||
|
||||
@@ -297,12 +297,14 @@ class SeerEditorWidgetAssembly : public QWidget, protected Ui::SeerEditorWidgetA
|
||||
|
||||
public slots:
|
||||
void reloadAssembly ();
|
||||
void reloadRegisters ();
|
||||
void showSearchBar (bool flag);
|
||||
void setSearchMatchCase (bool flag);
|
||||
void setShowAddressColumn (bool flag);
|
||||
void setShowOffsetColumn (bool flag);
|
||||
void setShowOpcodeColumn (bool flag);
|
||||
void setShowSourceLines (bool flag);
|
||||
void handleText (const QString& text);
|
||||
|
||||
private slots:
|
||||
void handleSearchLineNumberLineEdit ();
|
||||
@@ -317,7 +319,12 @@ class SeerEditorWidgetAssembly : public QWidget, protected Ui::SeerEditorWidgetA
|
||||
void handleShowSourceLines ();
|
||||
|
||||
signals:
|
||||
void evaluateVariableExpression (int expressionid, QString expression);
|
||||
|
||||
private:
|
||||
int _pcId;
|
||||
int _spId;
|
||||
int _flagsId;
|
||||
SeerKeySettings _keySettings;
|
||||
QShortcut* _textSearchShortcut;
|
||||
QShortcut* _textSearchNextShortcut;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>833</width>
|
||||
<height>555</height>
|
||||
<height>668</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -24,6 +24,88 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="pcLabel">
|
||||
<property name="text">
|
||||
<string>PC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="pcLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>40</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Program counter</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Program counter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="flagsLabel">
|
||||
<property name="text">
|
||||
<string>FLAGS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="flagsLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Processor flags</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Processor flags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="spLabel">
|
||||
<property name="text">
|
||||
<string>SP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="spLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Stack pointer</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Stack pointer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="searchBarWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
||||
@@ -20,7 +20,7 @@ SeerVariableLoggerBrowserWidget::SeerVariableLoggerBrowserWidget (QWidget* paren
|
||||
variablesTreeWidget->resizeColumnToContents(1); // timestamp
|
||||
variablesTreeWidget->resizeColumnToContents(2); // name
|
||||
variablesTreeWidget->resizeColumnToContents(3); // value
|
||||
variablesTreeWidget->setColumnHidden(0, true); // Hide the 'number' column.
|
||||
variablesTreeWidget->setColumnHidden(0, true); // Hide the 'number' column.
|
||||
variablesTreeWidget->clear();
|
||||
|
||||
// Connect things.
|
||||
@@ -47,10 +47,13 @@ void SeerVariableLoggerBrowserWidget::handleText (const QString& text) {
|
||||
QString id_text = text.section('^', 0,0);
|
||||
QString value_text = Seer::parseFirst(text, "value=", '"', '"', false);
|
||||
|
||||
QList<QTreeWidgetItem*> matches = variablesTreeWidget->findItems(id_text, Qt::MatchExactly, 0);
|
||||
if (_ids.contains(id_text.toInt()) == true) {
|
||||
|
||||
if (matches.size() > 0) {
|
||||
matches.first()->setText(3, Seer::filterEscapes(value_text));
|
||||
QList<QTreeWidgetItem*> matches = variablesTreeWidget->findItems(id_text, Qt::MatchExactly, 0);
|
||||
|
||||
if (matches.size() > 0) {
|
||||
matches.first()->setText(3, Seer::filterEscapes(value_text));
|
||||
}
|
||||
}
|
||||
|
||||
}else if (text.contains(QRegExp("^([0-9]+)\\^error,msg="))) {
|
||||
@@ -62,13 +65,17 @@ void SeerVariableLoggerBrowserWidget::handleText (const QString& text) {
|
||||
QString id_text = text.section('^', 0,0);
|
||||
QString msg_text = Seer::parseFirst(text, "msg=", '"', '"', false);
|
||||
|
||||
QList<QTreeWidgetItem*> matches = variablesTreeWidget->findItems(id_text, Qt::MatchExactly, 0);
|
||||
if (_ids.contains(id_text.toInt()) == true) {
|
||||
|
||||
if (matches.size() > 0) {
|
||||
matches.first()->setText(3, Seer::filterEscapes(msg_text));
|
||||
QList<QTreeWidgetItem*> matches = variablesTreeWidget->findItems(id_text, Qt::MatchExactly, 0);
|
||||
|
||||
if (matches.size() > 0) {
|
||||
matches.first()->setText(3, Seer::filterEscapes(msg_text));
|
||||
}
|
||||
}
|
||||
|
||||
}else if (text.startsWith("^error,msg=\"No registers.\"")) {
|
||||
|
||||
variablesTreeWidget->clear();
|
||||
|
||||
}else{
|
||||
@@ -95,6 +102,10 @@ void SeerVariableLoggerBrowserWidget::handleEvaluateVariableExpression (int expr
|
||||
|
||||
QString id_text = QString::number(expressionid);
|
||||
|
||||
if (_ids.contains(id_text.toInt()) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem*> matches = variablesTreeWidget->findItems(id_text, Qt::MatchExactly, 0);
|
||||
|
||||
// Reuse existing item.
|
||||
@@ -145,6 +156,8 @@ void SeerVariableLoggerBrowserWidget::handleAddLineEdit () {
|
||||
|
||||
int id = Seer::createID();
|
||||
|
||||
_ids.insert(id); // Keep track of which ones are entered.
|
||||
|
||||
emit evaluateVariableExpression(id, variable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QSet>
|
||||
#include "ui_SeerVariableLoggerBrowserWidget.h"
|
||||
|
||||
class SeerVariableLoggerBrowserWidget : public QWidget, protected Ui::SeerVariableLoggerBrowserWidgetForm {
|
||||
@@ -28,6 +29,7 @@ class SeerVariableLoggerBrowserWidget : public QWidget, protected Ui::SeerVariab
|
||||
|
||||
protected:
|
||||
private:
|
||||
QSet<int> _ids;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user