Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
41fb51f
Adding al the files from BlendSplitter project
turbor Apr 19, 2022
67fccf2
Move BlendSplitter icon
turbor Apr 19, 2022
975952a
Improved stackviewer
turbor Apr 19, 2022
fb5f050
First working version with blendsplitter
turbor Apr 19, 2022
2f41c0f
Splitting now works as in blender
turbor Apr 19, 2022
1a58a27
Place all dockingwidgets in comment
turbor Apr 20, 2022
b3011f0
Removed DockableWidget related code
turbor Apr 20, 2022
b76f243
Fixed some crashes and added cursor shapes
turbor Apr 21, 2022
699fa02
Added QScrollArea to SwitchingWidget
turbor Apr 22, 2022
928a1c7
Introduced a QuickGuide explaining the splitter
turbor Apr 26, 2022
565050a
Save and load workspaces layout
turbor Apr 27, 2022
53a5def
Moved getEnabledWidget to SignalDispatcher
turbor Apr 28, 2022
d27bcf8
improved QuickGuide text
turbor Apr 30, 2022
bd6b0f4
Now select your workspace when starting
turbor Apr 30, 2022
e17b826
Rename the tabs by double clicking them
turbor May 1, 2022
363555d
Improved tab renamer
turbor May 2, 2022
be9e648
Code cleanup
turbor May 3, 2022
bc0b493
debugmessages
turbor May 3, 2022
0782d3e
Add objectnames
turbor May 3, 2022
5338939
SignalDispatcher becomes responsible for VDPDataStore
turbor May 4, 2022
45e9800
Fixes mouseover bug in tileviewer
turbor May 4, 2022
301d36a
Trying to improve StackViewer
turbor May 4, 2022
cbb077e
Some debug texts
turbor May 4, 2022
3f33b04
replace 'override final' with just 'final'
m9710797 May 3, 2022
c63ba22
Fixup after cleanup BlendSplitter construction
m9710797 May 3, 2022
3d13e28
removed deletes since widget owns the layout
turbor May 4, 2022
9b80f5f
Improved saved layout preferences
turbor May 4, 2022
ff79f08
Added PaletteView
turbor May 10, 2022
249fb58
SlotLayout changes now handled by SignalDispatcher
turbor May 11, 2022
7e025bd
layout fixes
m9710797 May 12, 2022
749f07c
Cleanup singleton implementation of SignalDispatcher
m9710797 May 12, 2022
9b6873b
simplify SignalDispatcher construction/destruction
m9710797 May 12, 2022
4620811
Don't use copy-assignment-operator in MSXPalette
m9710797 May 12, 2022
b5a9d4a
Don't store redundant msxPalette[] in MSXPalette
m9710797 May 12, 2022
9201767
Json save and load of widget in SwitchingWidget.
turbor May 16, 2022
1ac0a87
Merge branch 'master' into blendsplitter
turbor May 17, 2022
54d9a07
More signal/slot connect rewrites
turbor May 18, 2022
40e2c93
Extra preferences for autoconnect to openMSX
turbor May 19, 2022
4f892e3
Fixed missing QMetaObject::connectSlotsByName
turbor May 19, 2022
de7df52
layout fixes
m9710797 May 18, 2022
65e53fa
Tweak loadFromJson
m9710797 May 18, 2022
1dd57bb
Tweak SavesJsonInterface
m9710797 May 18, 2022
5fda6b0
Do not use 'symTable' and 'symtable' as two distict symbols within th…
m9710797 May 18, 2022
8bf05ae
globally replace 'unsigned char' -> 'uint8_t'
m9710797 May 18, 2022
a339c42
Simplify DebuggerForm::widgetFactory()
m9710797 May 18, 2022
1720800
No need for DisasmViewer::update() (instead need qOverload)
m9710797 May 18, 2022
20e2913
Get rid of deprecated signal
turbor May 21, 2022
3c2e4fd
Follow-up on 2c3fd4cf5d and 205a992a2d
m9710797 May 21, 2022
d5005b0
Simplify usage of QOverload -> qOverload
m9710797 May 21, 2022
56db34c
Have the SpriteViewer use MSXPalette
turbor May 23, 2022
39a9d42
.gitignore adaptions for qtcreator
turbor May 23, 2022
157b303
Have the BitMapViewer use MSXPalette
turbor May 23, 2022
20a221a
Have the TileViewer use MSXPalette
turbor May 23, 2022
f903b40
Removed the old PaletteDialog
turbor May 23, 2022
4d59b42
Fix two text issues/typos.
MBilderbeek May 24, 2022
5db0ee1
PaletteView with better autosync indication
turbor Jun 1, 2022
39c7752
Improving HexViewer
turbor Jun 26, 2022
73b0a03
Merge remote-tracking branch 'origin/master' into blendsplitter
turbor Aug 17, 2022
ff9c79c
More HexViewer improvements
turbor Aug 17, 2022
dc31bc7
Merge branch 'master' into blendsplitter
turbor Nov 22, 2022
3592c72
Add minor tooltip
turbor Nov 23, 2022
f7c0640
VDPRegViewer autodetects VDP in openMSX
turbor Nov 23, 2022
594e192
Avoid superfluous signals
turbor Nov 23, 2022
be840e9
Fix small display error in sprite info
turbor Jan 31, 2023
335a8d8
improve .gitignore
turbor Jan 31, 2023
dfb292e
Fix TileViewer layout
turbor Feb 2, 2023
b3b765d
Merge branch 'master' into blendsplitter
turbor Feb 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into blendsplitter
Keeping up to date with the latest work on the BreakpointViewer
  • Loading branch information
turbor committed Aug 17, 2022
commit 73b0a039cbab292c4e00bcd9e2976cd83d1977ff
101 changes: 79 additions & 22 deletions src/BreakpointViewer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "BreakpointViewer.h"
#include "Convert.h"
#include "CommClient.h"
#include "DebugSession.h"
#include "OpenMSXConnection.h"
#include "ScopedAssign.h"
#include "ranges.h"
Expand All @@ -17,17 +18,18 @@ enum TableColumns {
ENABLED = 0,
WP_TYPE = 1,
LOCATION = 2,
BP_ADDRESS = 2,
WP_REGION = 2,
T_CONDITION = 3,
SLOT = 4,
SEGMENT = 5,
ID = 6
ID = 6,
REAL_ADDRESS = 7,
};

BreakpointViewer::BreakpointViewer(QWidget* parent)
: QTabWidget(parent),
ui(new Ui::BreakpointViewer)
BreakpointViewer::BreakpointViewer(DebugSession& session, QWidget* parent)
: QTabWidget(parent),
ui(new Ui::BreakpointViewer),
debugSession(session)
{
setupUi(this);

Expand All @@ -39,9 +41,10 @@ BreakpointViewer::BreakpointViewer(QWidget* parent)
connect(btnRemoveCn, &QPushButton::clicked, this, &BreakpointViewer::on_btnRemoveCn_clicked);

bpTableWidget->horizontalHeader()->setHighlightSections(false);
bpTableWidget->sortByColumn(BP_ADDRESS, Qt::AscendingOrder);
bpTableWidget->sortByColumn(LOCATION, Qt::AscendingOrder);
bpTableWidget->setColumnHidden(WP_TYPE, true);
bpTableWidget->setColumnHidden(ID, true);
bpTableWidget->setColumnHidden(REAL_ADDRESS, true);
bpTableWidget->resizeColumnsToContents();
bpTableWidget->setSortingEnabled(true);
connect(bpTableWidget, &QTableWidget::itemPressed, this, &BreakpointViewer::on_itemPressed);
Expand All @@ -51,6 +54,7 @@ BreakpointViewer::BreakpointViewer(QWidget* parent)

wpTableWidget->horizontalHeader()->setHighlightSections(false);
wpTableWidget->setColumnHidden(ID, true);
wpTableWidget->setColumnHidden(REAL_ADDRESS, true);
wpTableWidget->sortByColumn(WP_REGION, Qt::AscendingOrder);
wpTableWidget->resizeColumnsToContents();
wpTableWidget->setSortingEnabled(true);
Expand Down Expand Up @@ -254,7 +258,7 @@ void BreakpointViewer::setBreakpointChecked(BreakpointRef::Type type, int row, Q
table->setSortingEnabled(oldValue);
}

void BreakpointViewer::setTextField(BreakpointRef::Type type, int row, int column, const QString& value)
void BreakpointViewer::setTextField(BreakpointRef::Type type, int row, int column, const QString& value, const QString& tooltip)
{
auto sa = ScopedAssign(userMode, false);

Expand All @@ -264,6 +268,7 @@ void BreakpointViewer::setTextField(BreakpointRef::Type type, int row, int colum

table->setSortingEnabled(false);
item->setText(value);
item->setToolTip(tooltip);
table->setSortingEnabled(oldValue);
}

Expand Down Expand Up @@ -309,13 +314,24 @@ std::optional<uint8_t> BreakpointViewer::parseSegmentField(std::optional<int> in
return {};
}

std::optional<AddressRange> BreakpointViewer::parseSymbolOrValue(const QString& field) const
{
if (Symbol* s = debugSession.symbolTable().getAddressSymbol(field)) {
return AddressRange{uint16_t(s->value())};
}
if (auto address = stringToValue<uint16_t>(field)) {
return AddressRange{*address};
}
return {};
}

static const char* ComboTypeNames[] = { "read_mem", "write_mem", "read_io", "write_io" };

std::optional<AddressRange> BreakpointViewer::parseLocationField(
std::optional<int> index, BreakpointRef::Type type, const QString& field, const QString& comboTxt)
{
if (type == BreakpointRef::BREAKPOINT) {
auto value = stringToValue<uint16_t>(field);
auto value = parseSymbolOrValue(field);
return value ? AddressRange{*value}
: (index ? breakpoints->getBreakpoint(*index).range : std::optional<AddressRange>());
}
Expand Down Expand Up @@ -367,27 +383,32 @@ void BreakpointViewer::changeTableItem(BreakpointRef::Type type, QTableWidgetIte
case LOCATION: {
auto* model = table->model();
auto* combo = (QComboBox*) table->indexWidget(model->index(row, WP_TYPE));
int adrLen;
int adrLen;

if (type == BreakpointRef::CONDITION) {
return;
} else if (type == BreakpointRef::WATCHPOINT) {
auto wType = static_cast<Breakpoint::Type>(combo->currentIndex() + 1);
adrLen = (wType == Breakpoint::WATCHPOINT_IOREAD || wType == Breakpoint::WATCHPOINT_IOWRITE)
? 2 : 4;
? 2 : 4;
} else {
adrLen = 4;
}

if (auto range = parseLocationField(index, type, item->text(), combo ? combo->currentText() : "")) {
auto [begin, end] = *range;
setTextField(type, row, LOCATION, QString("%1%2%3")
.arg(hexValue(begin, adrLen))
.arg(end ? ":" : "")
.arg(end ? hexValue(*end, adrLen) : ""));
QString address = QString("%1%2%3")
.arg(hexValue(begin, adrLen))
.arg(end ? ":" : "")
.arg(end ? hexValue(*end, adrLen) : "");
// Use a symbolic address in the location field if available
QString location = debugSession.symbolTable().getAddressSymbol(item->text()) ? item->text() : address;
setTextField(type, row, LOCATION, location, location != address ? address : "");
setTextField(type, row, REAL_ADDRESS, address);
} else {
enabled = false;
setTextField(type, row, LOCATION, "");
setTextField(type, row, REAL_ADDRESS, "");
setBreakpointChecked(type, row, Qt::Unchecked);
}
if (!enabled) return;
Expand Down Expand Up @@ -706,7 +727,7 @@ int BreakpointViewer::createTableRow(BreakpointRef::Type type, int row)
createComboBox(row);
}

// address
// location
auto* item2 = new QTableWidgetItem();
item2->setTextAlignment(Qt::AlignCenter);
table->setItem(row, LOCATION, item2);
Expand Down Expand Up @@ -742,6 +763,12 @@ int BreakpointViewer::createTableRow(BreakpointRef::Type type, int row)
item6->setText("");
table->setItem(row, ID, item6);

// real_address
auto* item7 = new QTableWidgetItem();
item7->setFlags(Qt::NoItemFlags);
item7->setText("");
table->setItem(row, REAL_ADDRESS, item7);

return row;
}

Expand All @@ -762,15 +789,24 @@ void BreakpointViewer::fillTableRow(int index, BreakpointRef::Type type, int row
combo->setCurrentIndex(static_cast<int>(bp.type) - 1);
}

// location
int locLen = (bp.type == Breakpoint::WATCHPOINT_IOREAD
|| bp.type == Breakpoint::WATCHPOINT_IOWRITE) ? 2 : 4;
QString location = QString("%1%2%3").arg(hexValue(bp.range->start, locLen))
.arg(bp.range->end ? ":" : "")
.arg(bp.range->end ? hexValue(*bp.range->end, locLen) : "");

// location
auto* item2 = table->item(row, LOCATION);
QString location;

if (bp.type == Breakpoint::BREAKPOINT) {
if (Symbol* s = debugSession.symbolTable().getAddressSymbol(item2->text())) {
if (s->value() == bp.range->start) {
location = s->text();
}
}
}
if (location.isEmpty()) {
int locLen = (bp.type == Breakpoint::WATCHPOINT_IOREAD
|| bp.type == Breakpoint::WATCHPOINT_IOWRITE) ? 2 : 4;
location = QString("%1%2%3").arg(hexValue(bp.range->start, locLen))
.arg(bp.range->end ? ":" : "")
.arg(bp.range->end ? hexValue(*bp.range->end, locLen) : "");
}
item2->setText(location);

auto* item3 = table->item(row, T_CONDITION);
Expand Down Expand Up @@ -817,6 +853,27 @@ std::optional<Breakpoint> BreakpointViewer::parseTableRow(BreakpointRef::Type ty
return bp;
}


void BreakpointViewer::onSymbolTableChanged()
{
for (int row = 0; row < bpTableWidget->rowCount(); ++row) {
auto* item = bpTableWidget->item(row, REAL_ADDRESS);

// scan tooltip validity
if (!item->text().isEmpty()) {
Symbol* s = debugSession.symbolTable().getAddressSymbol(item->text());
auto address = stringToValue<uint16_t>(item->text());
assert(address);

if (!s || *address != s->value()) {
setTextField(BreakpointRef::BREAKPOINT, row, LOCATION, item->text());
setTextField(BreakpointRef::BREAKPOINT, row, REAL_ADDRESS, "");
}
}
}
}


void BreakpointViewer::onAddBtnClicked(BreakpointRef::Type type)
{
auto sa = ScopedAssign(userMode, false);
Expand Down
11 changes: 9 additions & 2 deletions src/BreakpointViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class QPaintEvent;
class Breakpoints;
class DebugSession;

struct BreakpointRef {
enum Type { BREAKPOINT, WATCHPOINT, CONDITION, ALL } type;
Expand All @@ -24,9 +25,10 @@ class BreakpointViewer : public QTabWidget, private Ui::BreakpointViewer
{
Q_OBJECT
public:
BreakpointViewer(QWidget* parent = nullptr);
BreakpointViewer(DebugSession& session, QWidget* parent = nullptr);
void setBreakpoints(Breakpoints* bps);

void onSymbolTableChanged();
void on_btnAddBp_clicked();
void on_btnRemoveBp_clicked();
void on_btnAddWp_clicked();
Expand All @@ -42,7 +44,10 @@ class BreakpointViewer : public QTabWidget, private Ui::BreakpointViewer
void contentsUpdated(bool merge);

private:
void setTextField(BreakpointRef::Type type, int row, int column, const QString& value);
void setTextField(BreakpointRef::Type type, int row, int column, const QString& value, const QString& tooltip = {});

std::optional<AddressRange> parseSymbolOrValue(const QString& field) const;

std::optional<AddressRange> parseLocationField(std::optional<int> index,
BreakpointRef::Type type,
const QString& field,
Expand Down Expand Up @@ -86,6 +91,8 @@ class BreakpointViewer : public QTabWidget, private Ui::BreakpointViewer

private:
Ui::BreakpointViewer* ui;
DebugSession& debugSession;

QTableWidget* tables[BreakpointRef::ALL];
std::map<QString, BreakpointRef> maps[BreakpointRef::ALL];

Expand Down
10 changes: 10 additions & 0 deletions src/BreakpointViewer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
<string>#</string>
</property>
</column>
<column>
<property name="text">
<string>real_addr</string>
</property>
</column>
</widget>
</item>
<item>
Expand Down Expand Up @@ -237,6 +242,11 @@
<string>#</string>
</property>
</column>
<column>
<property name="text">
<string>real_addr</string>
</property>
</column>
</widget>
</item>
<item>
Expand Down
55 changes: 33 additions & 22 deletions src/CPURegsViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "CPURegs.h"
#include "CommClient.h"
#include "OpenMSXConnection.h"
#include "ranges.h"
#include <QPainter>
#include <QPaintEvent>
#include <QMessageBox>
Expand All @@ -12,9 +13,9 @@ CPURegsViewer::CPURegsViewer(QWidget* parent)
{
setObjectName("CPURegsViewer");
// avoid UMR
memset(&regs, 0, sizeof(regs));
memset(&regsChanged, 0, sizeof(regsChanged));
memset(&regsModified, 0, sizeof(regsModified));
regs.fill(0);
regsChanged.fill(false);
regsModified.fill(false);

setFrameStyle(WinPanel | Sunken);
setFocusPolicy(Qt::StrongFocus);
Expand Down Expand Up @@ -174,8 +175,8 @@ void CPURegsViewer::setData(uint8_t* datPtr)

// reset modifications
cursorLoc = -1;
memset(&regsModified, 0, sizeof(regsModified));
memcpy(&regsCopy, &regs, sizeof(regs));
regsModified.fill(false);
regsCopy = regs;

update();

Expand Down Expand Up @@ -223,7 +224,7 @@ void CPURegsViewer::keyPressEvent(QKeyEvent* e)
int move = e->key();
if ((e->key() >= Qt::Key_0 && e->key() <= Qt::Key_9) ||
(e->key() >= Qt::Key_A && e->key() <= Qt::Key_F)) {
// calculate numercial value
// calculate numerical value
int v = e->key() - Qt::Key_0;
if (v > 9) v -= Qt::Key_A - Qt::Key_0 - 10;
// modify value
Expand Down Expand Up @@ -351,26 +352,36 @@ void CPURegsViewer::applyModifications()
}
// update screen
update();

// update disasm window
if (regsChanged[CpuRegs::REG_PC]) {
emit pcChanged(regs[CpuRegs::REG_PC]);
}
}

void CPURegsViewer::cancelModifications()
{
bool mod = false;
for (int i = 0; i < 14; ++i) mod |= regsModified[i];
if (!mod) return;

int ret = QMessageBox::warning(
this,
tr("CPU registers changes"),
tr("You made changes to the CPU registers.\n"
"Do you want to apply your changes or ignore them?"),
QMessageBox::Apply | QMessageBox::Ignore,
QMessageBox::Ignore);
if (ret == QMessageBox::Ignore) {
memcpy(&regs, &regsCopy, sizeof(regs));
memset(&regsModified, 0, sizeof(regsModified));
} else {
applyModifications();
static bool isVisible = false;

if (!ranges::contains(regsModified, true)) return;

if (!isVisible) {
isVisible = true;
// this modal window blocks execution of next instruction
int ret = QMessageBox::warning(
this,
tr("CPU registers changes"),
tr("You made changes to the CPU registers.\n"
"Do you want to apply your changes or ignore them?"),
QMessageBox::Apply | QMessageBox::Ignore,
QMessageBox::Ignore);
isVisible = false;
if (ret == QMessageBox::Ignore) {
regs = regsCopy;
regsModified.fill(false);
} else {
applyModifications();
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/CPURegsViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CPUREGSVIEWER_H

#include <QFrame>
#include <array>

class QPaintEvent;

Expand Down Expand Up @@ -33,9 +34,10 @@ public slots:
int leftRegPos, leftValuePos, rightRegPos, rightValuePos;
int rowHeight;

int regs[16], regsCopy[16];
bool regsModified[16];
bool regsChanged[16];
std::array<int, 16> regs;
std::array<int, 16> regsCopy;
std::array<bool, 16> regsModified;
std::array<bool, 16> regsChanged;
int cursorLoc;

void drawValue(QPainter& p, int id, int x, int y);
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.