MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / watchModified

Method watchModified

gui/qt/debugger.cpp:1604–1725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1602}
1603
1604void MainWindow::watchModified(QTableWidgetItem *item) {
1605 if (item == Q_NULLPTR) {
1606 return;
1607 }
1608
1609 int row = item->row();
1610 int col = item->column();
1611 QString lowStr;
1612 QString highStr;
1613 uint32_t addr;
1614
1615 m_watchpoints->blockSignals(true);
1616
1617 if (col == WATCH_NAME_COL) {
1618 updateLabels();
1619 } if (col == WATCH_LOW_COL) {
1620 std::string s = item->text().toUpper().toStdString();
1621 QString equate;
1622
1623 equate = getAddressOfEquate(s);
1624 if (!equate.isEmpty()) {
1625 s = equate.toStdString();
1626 m_watchpoints->blockSignals(true);
1627 if (m_watchpoints->item(row, WATCH_NAME_COL)->text() == (QStringLiteral("Label") + QString::number(row))) {
1628 m_watchpoints->item(row, WATCH_NAME_COL)->setText(item->text());
1629 }
1630 m_watchpoints->blockSignals(false);
1631 }
1632
1633 addr = static_cast<uint32_t>(hex2int(QString::fromStdString(s)));
1634 highStr = m_watchpoints->item(row, WATCH_HIGH_COL)->text();
1635
1636 if (isNotValidHex(s) || s.length() > 6 ||
1637 (highStr != DEBUG_UNSET_ADDR && addr > static_cast<uint32_t>(hex2int(highStr)))) {
1638 item->setText(m_prevWatchLow);
1639 m_watchpoints->blockSignals(false);
1640 return;
1641 }
1642
1643 lowStr = int2hex(addr, 6);
1644
1645 // return if address is already set in this range
1646 for (int i = 0; i < m_watchpoints->rowCount(); i++) {
1647 if (m_watchpoints->item(i, WATCH_LOW_COL)->text() == lowStr &&
1648 m_watchpoints->item(i, WATCH_HIGH_COL)->text() == highStr &&
1649 i != row) {
1650 item->setText(m_prevWatchLow);
1651 m_watchpoints->blockSignals(false);
1652 return;
1653 }
1654 }
1655
1656 if (m_prevWatchLow != DEBUG_UNSET_ADDR) {
1657 uint32_t low = static_cast<uint32_t>(hex2int(m_prevWatchLow));
1658 uint32_t high = static_cast<uint32_t>(hex2int(m_watchpoints->item(row, WATCH_HIGH_COL)->text()));
1659
1660 for (uint32_t watch_addr = low; watch_addr <= high; watch_addr++) {
1661 debug_watch(watch_addr, DBG_MASK_READ | DBG_MASK_WRITE, false);

Callers

nothing calls this directly

Calls 7

getAddressOfEquateFunction · 0.85
hex2intFunction · 0.85
isNotValidHexFunction · 0.85
int2hexFunction · 0.85
debug_watchFunction · 0.85
rowMethod · 0.80
rowCountMethod · 0.80

Tested by

no test coverage detected