aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/programdock.cpp2
-rw-r--r--qtmips_gui/programmodel.cpp22
-rw-r--r--qtmips_gui/programmodel.h1
3 files changed, 23 insertions, 2 deletions
diff --git a/qtmips_gui/programdock.cpp b/qtmips_gui/programdock.cpp
index a355b22..0466cc2 100644
--- a/qtmips_gui/programdock.cpp
+++ b/qtmips_gui/programdock.cpp
@@ -97,6 +97,8 @@ ProgramDock::ProgramDock(QWidget *parent, QSettings *settings) : Super(parent) {
this, SLOT(set_follow_inst(int)));
connect(this, SIGNAL(focus_addr(std::uint32_t)),
program_content, SLOT(focus_address(std::uint32_t)));
+ connect(program_content, SIGNAL(doubleClicked(QModelIndex)),
+ program_model, SLOT(toggle_hw_break(QModelIndex)));
}
void ProgramDock::setup(machine::QtMipsMachine *machine) {
diff --git a/qtmips_gui/programmodel.cpp b/qtmips_gui/programmodel.cpp
index 19b0f0d..4a758b7 100644
--- a/qtmips_gui/programmodel.cpp
+++ b/qtmips_gui/programmodel.cpp
@@ -113,15 +113,18 @@ QVariant ProgramModel::data(const QModelIndex &index, int role) const {
if (role == Qt::BackgroundRole) {
std::uint32_t address;
if (!get_row_address(address, index.row()) ||
- machine == nullptr || index.column() != 2)
+ machine == nullptr)
return QVariant();
- if (machine->cache_program() != nullptr) {
+ if (index.column() == 2 && machine->cache_program() != nullptr) {
machine::LocationStatus loc_stat;
loc_stat = machine->cache_program()->location_status(address);
if (loc_stat & machine::LOCSTAT_CACHED) {
QBrush bgd(Qt::lightGray);
return bgd;
}
+ } else if (index.column() == 0 && machine->is_hwbreak(address)) {
+ QBrush bgd(Qt::red);
+ return bgd;
}
return QVariant();
}
@@ -185,3 +188,18 @@ bool ProgramModel::adjustRowAndOffset(int &row, int optimal_row, std::uint32_t a
}
return get_row_for_address(row, address);
}
+
+void ProgramModel::toggle_hw_break(const QModelIndex & index) {
+ std::uint32_t address;
+ if (index.column() != 0 || machine == nullptr)
+ return;
+
+ if (!get_row_address(address, index.row()))
+ return;
+
+ if (machine->is_hwbreak(address))
+ machine->remove_hwbreak(address);
+ else
+ machine->insert_hwbreak(address);
+ update_all();
+}
diff --git a/qtmips_gui/programmodel.h b/qtmips_gui/programmodel.h
index 4a17e99..a6db493 100644
--- a/qtmips_gui/programmodel.h
+++ b/qtmips_gui/programmodel.h
@@ -85,6 +85,7 @@ public:
public slots:
void setup(machine::QtMipsMachine *machine);
void check_for_updates();
+ void toggle_hw_break(const QModelIndex & index);
private:
std::uint32_t index0_offset;