| 131 | } |
| 132 | |
| 133 | ResultCode BreakpointManager::AddBreakpoint(uint32_t nodeId, uint32_t goalId, bool isInit, int32_t actionIndex, BreakpointType type) |
| 134 | { |
| 135 | if (type & ~BreakpointTypeAll) { |
| 136 | Debug("Debugger::AddBreakpoint(): Unsupported breakpoint type set: %08x", type); |
| 137 | return ResultCode::UnsupportedBreakpointType; |
| 138 | } |
| 139 | |
| 140 | if (nodeId > (*globals_.Nodes)->Db.Size) { |
| 141 | Debug("Debugger::AddBreakpoint(): Tried to set on nonexistent node ID %d", nodeId); |
| 142 | return ResultCode::InvalidNodeId; |
| 143 | } |
| 144 | |
| 145 | if (goalId > (*globals_.Goals)->Count) { |
| 146 | Debug("Debugger::AddBreakpoint(): Tried to set on nonexistent goal ID %d", nodeId); |
| 147 | return ResultCode::InvalidGoalId; |
| 148 | } |
| 149 | |
| 150 | uint64_t breakpointId; |
| 151 | if (actionIndex == -1) { |
| 152 | if (nodeId == 0) { |
| 153 | Debug("Debugger::AddBreakpoint(): Node ID must be nonzero for node actions", nodeId); |
| 154 | return ResultCode::InvalidNodeId; |
| 155 | } |
| 156 | |
| 157 | breakpointId = MakeNodeBreakpointId(nodeId); |
| 158 | } |
| 159 | else { |
| 160 | if (nodeId != 0) { |
| 161 | breakpointId = MakeRuleActionBreakpointId(nodeId, actionIndex); |
| 162 | } |
| 163 | else if (goalId != 0) { |
| 164 | if (isInit) { |
| 165 | breakpointId = MakeGoalInitBreakpointId(goalId, actionIndex); |
| 166 | } |
| 167 | else { |
| 168 | breakpointId = MakeGoalExitBreakpointId(goalId, actionIndex); |
| 169 | } |
| 170 | } |
| 171 | else { |
| 172 | Debug("Debugger::AddBreakpoint(): No node/goal specified"); |
| 173 | return ResultCode::InvalidNodeId; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | Debug("Debugger::AddBreakpoint(): Set on key %016x to %08x", breakpointId, type); |
| 178 | Breakpoint bp; |
| 179 | bp.nodeId = nodeId; |
| 180 | bp.goalId = goalId; |
| 181 | bp.isInit = isInit; |
| 182 | bp.actionIndex = actionIndex; |
| 183 | bp.type = type; |
| 184 | (*pendingBreakpoints_)[breakpointId] = bp; |
| 185 | |
| 186 | return ResultCode::Success; |
| 187 | } |
| 188 | |
| 189 | void BreakpointManager::FinishUpdatingNodeBreakpoints() |
| 190 | { |
no test coverage detected