MCPcopy Create free account
hub / github.com/WheretIB/nullc / AddBreakpoint

Method AddBreakpoint

NULLC/Executor.cpp:2342–2369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2340}
2341
2342bool 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
2371bool Executor::RemoveBreakpoint(unsigned int instruction)
2372{

Callers 1

Calls 4

VMCmdClass · 0.85
SafeSprintfFunction · 0.70
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected