microsoft / vscode-chrome-debug-core

A library for implementing VS Code debug adapters for targets that implement the Chrome Debugging Protocol.
Other
157 stars 119 forks source link

Hermes debugger problems #517

Open RedMickey opened 5 years ago

RedMickey commented 5 years ago

Hermes debugger problems

Hello, we are the development team of VS Code extension for debugging React Native apps (vscode-react-native). Now we are working on the prototype of React Native Hermes debugger and we've faced several problems of using vscode-chrome-debug-core lib. We think that the problems might be on vscode-chrome-debug-core side, because our implementation extends chromeDebugAdapter without significant structural changes. There are also some issues with React Native Hermes debugging in Chrome itself. Could you please look through the list of problems that we faced with?

Here is a link for sources of the direct debugger: https://github.com/microsoft/vscode-react-native/tree/master/src/debugger/direct

roblourens commented 5 years ago

Looking at this briefly, for problem 2 I see that this runtime's implementation of the devtools protocol diverges from chrome/node. It isn't giving a description property for numeric values, and this library is expecting that: https://github.com/Microsoft/vscode-chrome-debug-core/blob/master/src/chrome/variables.ts#L272

I'm guessing that the others are similar issues. I know very little about React Native, can you tell me how the debugger works here? Is it based on an old version of chrome/a fork, or is it a totally new implementation? If there are lots of little differences then it could be a lot of work to fully support it. Also note that we are working on a large change to this library and it could be more forgiving in some ways. It's in the branch v2 of this repo.

RedMickey commented 5 years ago

@roblourens For debugging React Native Hermes apps we use the direct debugging approach. It means that Hermes engine inside the React Native Android application launches a DevTools server which is waiting for Chrome DevTools Protocol connection. Our extension connects to this server by means of ChromeDebugAdapter. We took pure ChromeDebugAdapter from lib vscode-chrome-debug-core:^6.7.46 and added specific logic for work with React Native applications in its attach and launch functions, but we call super.launch and super.attach functions without changes. In the launch function we added special functional for launching Android Hermes apps, but it doesn’t modify base implementations from ChromeDebugAdapter. In the attach function we just added telemetry.

roblourens commented 5 years ago

Ok, it sounds like this is a new implementation of the chrome debug protocol. There could be bugs in Hermes but it's unfortunate that the protocol is not specced more strictly because at least in the one I describe above, I can't say that it is violating the spec. We will just have to find these differences, fix them one by one, and add tests. You could test to find out how well the v2 branch is currently working with Hermes. FYI @digeff

RedMickey commented 5 years ago

@roblourens @digeff We created the issue about known React Native Hermes debugging problems in our repository and moved the list of problems there. In this issue we'll collect user's feedback and add new Hermes debugging issues if we face ones.

SounD120 commented 4 years ago

Hi @roblourens @digeff . A new problem appeared after the VS Code 1.39 update. After setting a breakpoint when debugging Hermes the following message shows up in debug console:

Error processing "breakpointLocations": TypeError: Cannot read property 'map' of undefined
    at Breakpoints.<anonymous> (c:\Work\vscode-react-native\node_modules\vscode-chrome-debug-core\out\src\chrome\breakpoints.js:303:68)
    at Generator.next (<anonymous>)
    at fulfilled (c:\Work\vscode-react-native\node_modules\vscode-chrome-debug-core\out\src\chrome\breakpoints.js:7:58)

I looked at the code and found out that possibleBpResponse could be undefined at here and this might be the cause of this message. Logs for such case: chrome-debug-core-session.txt Could you please take a look?

roblourens commented 4 years ago

@SounD120 this isn't related to Hermes, please open a new issue. It sounds like React Native is doing something weird though because locations shouldn't be undefined.