| 83 | } |
| 84 | |
| 85 | void BreakpointDialog::accept() |
| 86 | { |
| 87 | std::string error; |
| 88 | |
| 89 | if (m_purpose == PURPOSE::CREATE) |
| 90 | { |
| 91 | if (m_ui.rdoExecute->isChecked()) |
| 92 | m_bp_mc = BreakPoint(); |
| 93 | else if (m_ui.rdoMemory->isChecked()) |
| 94 | m_bp_mc = MemCheck(); |
| 95 | } |
| 96 | |
| 97 | if (auto* bp = std::get_if<BreakPoint>(&m_bp_mc)) |
| 98 | { |
| 99 | PostfixExpression expr; |
| 100 | |
| 101 | u64 address; |
| 102 | if (!m_cpu->evaluateExpression(m_ui.txtAddress->text().toStdString().c_str(), address, error)) |
| 103 | { |
| 104 | AsyncDialogs::warning(g_debugger_window, tr("Invalid Address"), QString::fromStdString(error)); |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | bp->addr = address; |
| 109 | bp->description = m_ui.txtDescription->text().toStdString(); |
| 110 | |
| 111 | bp->enabled = m_ui.chkEnable->isChecked(); |
| 112 | |
| 113 | if (!m_ui.txtCondition->text().isEmpty()) |
| 114 | { |
| 115 | bp->hasCond = true; |
| 116 | bp->cond.debug = m_cpu; |
| 117 | |
| 118 | if (!m_cpu->initExpression(m_ui.txtCondition->text().toStdString().c_str(), expr, error)) |
| 119 | { |
| 120 | AsyncDialogs::warning(g_debugger_window, tr("Invalid Condition"), QString::fromStdString(error)); |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | bp->cond.expression = expr; |
| 125 | bp->cond.expressionString = m_ui.txtCondition->text().toStdString(); |
| 126 | } |
| 127 | else |
| 128 | { |
| 129 | bp->hasCond = false; |
| 130 | bp->cond = {}; |
| 131 | } |
| 132 | } |
| 133 | if (auto* mc = std::get_if<MemCheck>(&m_bp_mc)) |
| 134 | { |
| 135 | u64 startAddress; |
| 136 | if (!m_cpu->evaluateExpression(m_ui.txtAddress->text().toStdString().c_str(), startAddress, error)) |
| 137 | { |
| 138 | AsyncDialogs::warning(g_debugger_window, tr("Invalid Address"), QString::fromStdString(error)); |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | u64 size; |
nothing calls this directly
no test coverage detected