-
Notifications
You must be signed in to change notification settings - Fork 684
Initial version of JerryScript debugger #1557
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
Merged
tilmannOSG
merged 1 commit into
jerryscript-project:master
from
polaroi8d:remote-debugger
Feb 14, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
## JerryScript debugger interface | ||
|
||
JerryScript provides a remote debugger which allows debugging | ||
JavaScript programs. The debugger has two main components: | ||
a server which is part of the JerryScript binary and a | ||
separate client application. Currently two debugger clients | ||
are available in the /jerry-debugger subdirectory: an HTML | ||
and a Python application. These simple applications demonstrate | ||
the communication protocol between the client and server and can | ||
be reused by integrated development environments. | ||
|
||
## Setting up the debugger server | ||
|
||
The following arguments must be passed to `tools/build.py`: | ||
|
||
`--jerry-debugger=on --jerry-libc=off` | ||
|
||
At the moment only a Websocket-based implementation is provided | ||
by JerryScript which transmits messages over TCP/IP networks. | ||
This implementation requires a socket API which is not yet | ||
supported by jerry-libc so the standard libc is used instead. | ||
In the future any reliable stream or datagram based protocol | ||
can be used for transmitting debugger messages. | ||
|
||
## Debugging JavaScript applications | ||
|
||
The debugger client must be connected to the server before the | ||
JavaScript application runs. On-the-fly attachment is not supported | ||
because the debugging information (e.g. line index of each possible | ||
breakpoint location) is not preserved by JerryScript. The client is | ||
expected to be run on a system with much more resources and it should | ||
be capable of storing this information. JerryScript frees all debug | ||
information after it is transmitted to the client to save memory. | ||
|
||
The following argument makes JerryScript wait for a client | ||
connection: | ||
|
||
`--start-debug-server` | ||
|
||
It is also recommended to increase the log level to see | ||
the *Waiting for client connection* message: | ||
|
||
`--log-level 2` | ||
|
||
The HTML client can connect to the IP address of the server with | ||
the `connect` command. The IP address can be localhost | ||
if the server and the client are running on the same machine. | ||
|
||
After the connection is established the execution can be | ||
controlled by the debugger. The debugger always stops at | ||
the first possible breakpoint location. The effect is the | ||
same as using the `stop` command. This allows inserting | ||
breakpoints right before the meaningful part of the execution | ||
starts. | ||
|
||
All available commands of the client can be queried by the | ||
`help` command. | ||
|
||
## Integrating debugger support into applications using JerryScript | ||
|
||
The debugger can be enabled by passing the `JERRY_INIT_DEBUGGER` flag | ||
to the `jerry_init ()` function which then initializes the debugger | ||
and blocks until a client connects. | ||
|
||
When the debugger is enabled it is recommended to use | ||
`jerry_parse_named_resource ()` instead of `jerry_parse ()` because | ||
the resource name (usually a file name) is also passed to this | ||
function. This resource name is used by the client to identify | ||
the corresponding resource. In general it is always recommended to | ||
use `jerry_parse_named_resource ()` when the resource name is | ||
available because it silently ignores the resource name if the | ||
debugger is disabled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we requires standard libc. Perhaps we should also add that feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check for it, if we build with python and use jerry-libc, the builder throw an error.