This project is read-only.

The logic in CodeCoverageRunner::OnNewLine(...)

Jul 27 at 4:21 AM

I am researching the source code of OpenCppCoverage. And I have question about the function CodeCoverageRunner::OnNewLine(). In this function, I see if you didn't manage to register address after setting break point, you would remove that breakpoint.

I had a look at function RegisterAddress(...). It seems if the address has been registered before, you would remove the breakpoint finally. Does that mean the breakpoint has been set twice, then you need remove the latter breakpoint, or the oldInstruction == 0xCC ?

Aug 13 at 1:13 PM

I am sorry for my late answer.
I wrote a draft several weeks ago and believed I already answered your question.

Here is how CodeCoverageRunner::OnNewLine works:
  • We always set a breakpoint (SetBreakPointAt)
  • If we previously set a breakpoint at this instruction (RegisterAddress return false)
  • We rollback to the previous state (RemoveBreakPoint).
RegisterAddress returns false only if we already register the address (If we can find the address inside ExecutedAddressManager::addressLineMap_)

I hope it will help,

Marked as answer by OpenCppCoverage on 10/21/2017 at 3:06 AM