microsoft / ChakraCore-Debugger

Debugging companion library for the ChakraCore JavaScript engine
MIT License
32 stars 25 forks source link

VS Code breakpoint problems #60

Open mjrgh opened 5 years ago

mjrgh commented 5 years ago

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.

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.

akroshg commented 5 years ago

@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 5 years ago

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.