| 60 | } |
| 61 | |
| 62 | QVariant BreakpointModel::data(const QModelIndex& index, int role) const |
| 63 | { |
| 64 | const size_t row = static_cast<size_t>(index.row()); |
| 65 | if (!index.isValid() || row >= m_breakpoints.size()) |
| 66 | return QVariant(); |
| 67 | |
| 68 | const BreakpointMemcheck& bp_mc = m_breakpoints[row]; |
| 69 | |
| 70 | if (role == Qt::DisplayRole) |
| 71 | { |
| 72 | if (const auto* bp = std::get_if<BreakPoint>(&bp_mc)) |
| 73 | { |
| 74 | switch (index.column()) |
| 75 | { |
| 76 | case BreakpointColumns::ENABLED: |
| 77 | return ""; |
| 78 | case BreakpointColumns::TYPE: |
| 79 | return tr("Execute"); |
| 80 | case BreakpointColumns::OFFSET: |
| 81 | return QtUtils::FilledQStringFromValue(bp->addr, 16); |
| 82 | case BreakpointColumns::DESCRIPTION: |
| 83 | return QString::fromStdString(bp->description); |
| 84 | case BreakpointColumns::SIZE_LABEL: |
| 85 | return QString::fromStdString(m_cpu.GetSymbolGuardian().FunctionStartingAtAddress(bp->addr).name); |
| 86 | case BreakpointColumns::OPCODE: |
| 87 | // Note: Fix up the disassemblymanager so we can use it here, instead of calling a function through the disassemblyview (yuck) |
| 88 | return m_cpu.disasm(bp->addr, true).c_str(); |
| 89 | case BreakpointColumns::CONDITION: |
| 90 | return bp->hasCond ? QString::fromStdString(bp->cond.expressionString) : ""; |
| 91 | case BreakpointColumns::HITS: |
| 92 | return tr("--"); |
| 93 | } |
| 94 | } |
| 95 | else if (const auto* mc = std::get_if<MemCheck>(&bp_mc)) |
| 96 | { |
| 97 | switch (index.column()) |
| 98 | { |
| 99 | case BreakpointColumns::ENABLED: |
| 100 | return ""; |
| 101 | case BreakpointColumns::TYPE: |
| 102 | { |
| 103 | QString type(""); |
| 104 | type += (mc->memCond & MEMCHECK_READ) ? tr("Read") : ""; |
| 105 | type += ((mc->memCond & MEMCHECK_READWRITE) == MEMCHECK_READWRITE) ? ", " : " "; |
| 106 | //: (C) = changes, as in "look for changes". |
| 107 | type += (mc->memCond & MEMCHECK_WRITE) ? (mc->memCond & MEMCHECK_WRITE_ONCHANGE) ? tr("Write(C)") : tr("Write") : ""; |
| 108 | return type; |
| 109 | } |
| 110 | case BreakpointColumns::OFFSET: |
| 111 | return QtUtils::FilledQStringFromValue(mc->start, 16); |
| 112 | case BreakpointColumns::DESCRIPTION: |
| 113 | return QString::fromStdString(mc->description); |
| 114 | case BreakpointColumns::SIZE_LABEL: |
| 115 | return QString::number(mc->end - mc->start, 16); |
| 116 | case BreakpointColumns::OPCODE: |
| 117 | return tr("--"); // Our address is going to point to memory, no purpose in printing the op |
| 118 | case BreakpointColumns::CONDITION: |
| 119 | return mc->hasCond ? QString::fromStdString(mc->cond.expressionString) : ""; |
no test coverage detected