microsoft/ChakraCore-Debugger

VS Code breakpoint problems

mjrgh opened this issue · 2 comments

mjrgh commented

I'm embedding ChakraCore and ChakraCore-Debug, and I'm running into a weird problem with VS Code. There are some similar issues reported on StackOverflow for VS Code with a Node debuggee, so it might be some generic problem on the VS Code side, but those threads all think that problem is in Node, so maybe there's a parallel bug in CC-D.

  • Launch a CC/CC-D debuggee from VS Code
  • Pause in the debugger, anywhere in the Javascript code
  • Set a breakpoint on a source line that doesn't have executable code
  • The breakpoint will appear correctly on the next line with executable code
  • Click on that same no-code line again to clear the breakpoint
    ** Problem: The breakpoint isn't cleared. VS Code now thinks it has two breakpoints on the nearby code line.
  • Click a third time on the no-code line to try clearing the breakpoint again
    ** Problem: The debuggee terminates abruptly

The abrupt termination seems to be coming from the VS Code side - if you look at the debuggee under the native code debugger, it doesn't appear to be crashing with an exception. But something's clearly in a bad state.

@mjrgh thanks for the reporting issue.
I can see this is reproing, by attaching vscode to the sample app.
What I observe here is that putting second time breakpoint on the vscode did not produce second breakpoint in the ChakraCore (runtime) side. There is still only one breakpoint in the ChakraCore side. However the vscode still believes the second breakpoint (which seems to be strange)
When we try to set the breakpoint third time, the vscode tries to remove both previously set breakpoints and then somewhere while removing the second breakpoint, it fails as the ChakraCore side has only one bp which has been removed.
I think if we ignore the result of the JsDiagRemoveBreakpoint then this fatal error can be avoided. I think letting the whole debug session down when we are unable to remove the breakpoint seems to be overkill.
I'll make the PR along with the changes.

mjrgh commented

I investigated this a bit on the VS Code side, and came up with what looks like the approach VS Code wants. Details in PR #61.