Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New debugging APIs #926

Merged
merged 1 commit into from
May 11, 2016
Merged

New debugging APIs #926

merged 1 commit into from
May 11, 2016

Conversation

agarwal-sandeep
Copy link
Collaborator

This PR adds debugging APIs to ChakraCore and test debugger to ch.

Sample tests are under test\Debugger. Once this PR is merged next PR will port existing PDM based debugger tests to run with ch/ChakraCore. I have already run those tests and don’t see any issue.

New APIs are prefixed with JsDiag to group them under a pseudo namespace, in future if we plan to have other diagnostic APIs this will help.
There are a total of 17 JsDiag* APIs. Currently the APIs on only exposed in ChakraCore once we have windows review this will be exposed in Chakra as well.

With this change the binary size of ChakraCore/Chakra increase by about a max of 19KB across all architectures which is acceptable.

To demonstrate the use, capabilities and completeness of these APIs Node-ChakraCore have been enhanced to provide debugging support with VSCode (no change to VSCode required). ChakraCore code in Node-ChakraCore is synced with this PR commit. The code is available at https://github.com/agarwal-sandeep/node-chakracore/tree/debugging

There is some more investigation required to make Node-Inspector work with Node-ChakraCore. I am working on it.

@agarwal-sandeep
Copy link
Collaborator Author

@akroshg @Yongqu @liminzhu @aruneshchandra please take a look

{
"scriptId": 3,
"fileName": "dummyfilename.js",
"lineCount": 1,
Copy link
Contributor

@akroshg akroshg May 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no scripttype for .js file or we are not logging it? #Resolved

Copy link
Collaborator Author

@agarwal-sandeep agarwal-sandeep May 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script type is only for dynamic script which doesn't have a filename. For such scripts filename is replaced with scriptType #Closed

LPCUTF8 source = functionBody->GetStartOfDocument(_u("Source for debugging"));
size_t startByte = utf8::CharacterIndexToByteIndex(source, functionBody->GetUtf8SourceInfo()->GetCbLength(), (const charcount_t)statementMap->sourceSpan.begin);

int byteLength = statementMap->sourceSpan.end - statementMap->sourceSpan.begin;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by byteLength did you mean bytecodeLength, since it is little confusing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a character difference.


In reply to: 62750414 [](ancestors = 62750414)

@liminzhu
Copy link
Collaborator

Looking good overall :). Left a few nitpicks here and there.

@chakrabot chakrabot merged commit 78c7913 into master May 11, 2016
chakrabot pushed a commit that referenced this pull request May 11, 2016
Merge pull request #926 from JsRTDebugging
This PR adds debugging APIs to _ChakraCore_ and test debugger to ch.

Sample tests are under [test\Debugger](https://github.com/Microsoft/ChakraCore/tree/JsRTDebugging/test/Debugger). Once this PR is merged next PR will port existing PDM based debugger tests to run with ch/ChakraCore. I have already run those tests and don’t see any issue.

New APIs are prefixed with _JsDiag_ to group them under a pseudo namespace, in future if we plan to have other diagnostic APIs this will help.
There are a total of 17 JsDiag* APIs. Currently the APIs on only exposed in ChakraCore once we have windows review this will be exposed in Chakra as well.

With this change the binary size of ChakraCore/Chakra increase by about a max of 19KB across all architectures which is acceptable.

To demonstrate the use, capabilities and completeness of these APIs [Node-ChakraCore](https://github.com/nodejs/node-chakracore) have been enhanced to provide debugging support with [VSCode](https://code.visualstudio.com/) (no change to VSCode required). ChakraCore code in Node-ChakraCore is synced with this PR commit. The code is available at https://github.com/agarwal-sandeep/node-chakracore/tree/debugging

There is some more investigation required to make [Node-Inspector]( https://github.com/node-inspector/node-inspector) work with Node-ChakraCore. I am working on it.
@MidoriYakumo
Copy link

Is this Visual Studio compatible? I can not try to step into Javascript code in Visual Studio with codes mix with C++ and Javascript

@agarwal-sandeep
Copy link
Collaborator Author

@MidoriYakumo VisualStudio support debugging using Chakra and PDM and is currently not supported for ChakraCore. If your scenario runs using node the you can use Node-ChakraCore to debug using VSCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants