| 2340 | } |
| 2341 | |
| 2342 | bool Executor::AddBreakpoint(unsigned int instruction, bool oneHit) |
| 2343 | { |
| 2344 | if(instruction > exLinker->exCode.size()) |
| 2345 | { |
| 2346 | SafeSprintf(execError, ERROR_BUFFER_SIZE, "ERROR: break position out of code range"); |
| 2347 | return false; |
| 2348 | } |
| 2349 | unsigned int pos = breakCode.size(); |
| 2350 | if(exLinker->exCode[instruction].cmd == cmdNop) |
| 2351 | { |
| 2352 | SafeSprintf(execError, ERROR_BUFFER_SIZE, "ERROR: cannot set breakpoint on breakpoint"); |
| 2353 | return false; |
| 2354 | } |
| 2355 | if(oneHit) |
| 2356 | { |
| 2357 | breakCode.push_back(exLinker->exCode[instruction]); |
| 2358 | exLinker->exCode[instruction].cmd = cmdNop; |
| 2359 | exLinker->exCode[instruction].flag = EXEC_BREAK_ONE_HIT_WONDER; |
| 2360 | exLinker->exCode[instruction].argument = pos; |
| 2361 | }else{ |
| 2362 | breakCode.push_back(exLinker->exCode[instruction]); |
| 2363 | breakCode.push_back(VMCmd(cmdNop, EXEC_BREAK_RETURN, 0, instruction + 1)); |
| 2364 | exLinker->exCode[instruction].cmd = cmdNop; |
| 2365 | exLinker->exCode[instruction].flag = EXEC_BREAK_SIGNAL; |
| 2366 | exLinker->exCode[instruction].argument = pos; |
| 2367 | } |
| 2368 | return true; |
| 2369 | } |
| 2370 | |
| 2371 | bool Executor::RemoveBreakpoint(unsigned int instruction) |
| 2372 | { |
no test coverage detected