-
Notifications
You must be signed in to change notification settings - Fork 683
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
Initial version of JerryScript debugger #1557
Conversation
jerry-core/jerry-api.h
Outdated
@@ -335,6 +338,7 @@ jerry_value_t jerry_exec_snapshot (const void *snapshot_p, size_t snapshot_size, | |||
size_t jerry_parse_and_save_literals (const jerry_char_t *source_p, size_t source_size, bool is_strict, | |||
uint8_t *buffer_p, size_t buffer_size, bool is_c_format); | |||
|
|||
|
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.
No need this newline.
#endif /* JERRY_DEBUGGER */ | ||
|
||
return jerry_parse (source_p, source_size, is_strict); | ||
} /* jerry_parse_named_resource */ |
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.
We need an api help / description for this function.
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.
Added, thanks.
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'm trying to understand how this works in a scenario where there are multiple .js source files.
It looks like there is no information kept after this function call that can be used to associate the bytecode back to the resource name. Perhaps I am missing something? Or is it just a TODO for the future?
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.
This information is sent to the debugger who keeps and use this. The concept is described in the documentation.
{ | ||
if (ident_line_counter != context_p->last_breakpoint_line) | ||
{ | ||
JERRY_DEBUG_MSG ("Insert var breakpoint: %d (%d)\n", ident_line_counter, context_p->last_breakpoint_line); |
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.
Somehow these messages are appear on the console. Why?
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.
Personally I would remove these two prints.
jerry-core/debugger/jerry-debugger.c
Outdated
/** | ||
* Debugger socket communication port. | ||
*/ | ||
#define PORT 5001 |
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.
These defines should use a prefix. What about JDEBUGGER_
?
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.
We use JERRY_DEBUGGER
prefix.
jerry-core/debugger/jerry-debugger.c
Outdated
WEBSOCKET_TEXT_FRAME = 1, /**< text frame */ | ||
WEBSOCKET_BINARY_FRAME = 2, /**< binary frame */ | ||
WEBSOCKET_CLOSE_CONNECTION = 8, /**< close connection */ | ||
WEBSOCKET_PING = 8, /**< ping (keep alive) frame */ |
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.
Do PING
and CLOSE_CONNECTION
have the same value intentionally?
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.
Nope. I will fix it.
jerry-core/debugger/jerry-debugger.c
Outdated
/** | ||
* Process WebSocket handshake. | ||
* | ||
* @return true - is no error is occured |
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.
Should be: "if no error occurred"
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.
Thanks
jerry-core/debugger/jerry-debugger.c
Outdated
/* | ||
* Send the message to the client side | ||
* | ||
* @return true - if the data was send successfully to the client side |
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.
Should be: "if the data was sent successfully ..."
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.
Thanks
jerry-core/debugger/jerry-debugger.h
Outdated
|
||
/** | ||
* Limited resources available for the engine, so it is important to | ||
* check the maximum buffer size. It need to be between 64 and 256. |
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.
It needs to be
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.
Thanks
jerry-core/debugger/jerry-sha1.c
Outdated
sha1_context_p->state[4] = 0xC3D2E1F0; | ||
} /* jerry_sha1_init */ | ||
|
||
#define P(a, b, c, d, e, x) \ |
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.
Missing description.
sha1_context_p->total[0] = 0; | ||
sha1_context_p->total[1] = 0; | ||
|
||
sha1_context_p->state[0] = 0x67452301; |
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.
Magic literals. Please give some comment at least.
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.
This come from the standard, we don't need a description for it, I think.
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.
Perhaps a description from what standard it came? ;-)
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.
The SHA-1 standard is mentioned in the first non-license block comment of the source file. I don't see the point of repeating it here. We could repeat it in every line of the code, since we invented nothing new here. I think the purpose (setting the initial state) is quite obvious.
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.
Right. Which only shows why comments might be necessary even in places where they don't seem to be, initially - because people will mis-read code, ignore context, etc. In this case I take the blame for doing so, and agree that surrounding context gives enough hints about it.
jerry-core/debugger/jerry-sha1.c
Outdated
|
||
#define SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) | ||
|
||
#define R(t) \ |
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.
ditto
jerry-core/debugger/jerry-sha1.c
Outdated
GET_UINT32_BE (W[14], data, 56); | ||
GET_UINT32_BE (W[15], data, 60); | ||
|
||
#define SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) |
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.
SHA1_SHIFT
jerry-core/ecma/base/ecma-helpers.c
Outdated
@@ -19,6 +19,8 @@ | |||
#include "ecma-helpers.h" | |||
#include "ecma-lcache.h" | |||
#include "ecma-property-hashmap.h" | |||
#include "jcontext.h" | |||
#include "jerry-debugger.h" |
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.
#ifdef JERRY_DEBUGGER
#include "jcontext.h"
#include "jerry-debugger.h"
#endif /* JERRY_DEBUGGER */
/** | ||
* Extra information for each breakpoint | ||
*/ | ||
typedef struct parser_breakpoint_info_t |
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.
typedef struct
{
@@ -1559,6 +1599,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */ | |||
parser_stack_push_uint8 (context_p, PARSER_STATEMENT_START); | |||
parser_stack_iterator_init (context_p, &context_p->last_statement); | |||
|
|||
#ifdef JERRY_DEBUGGER | |||
/* Set lexical enviroment for the debugger*/ |
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.
missing space before */
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.
👍
@@ -48,6 +48,7 @@ typedef struct | |||
ecma_value_t *stack_top_p; /**< stack top pointer */ | |||
jmem_cpointer_t *literal_start_p; /**< literal list start pointer */ | |||
ecma_object_t *lex_env_p; /**< current lexical environment */ | |||
struct vm_frame_ctx_t *prev_context_p; /**< previous context */ |
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.
Is this used, when the debugger is disabled?
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.
It is used now. Instead of a local variable it is stored as part of the structure.
jerry-main/main-unix.c
Outdated
else if (!strcmp ("--start-debug-server", argv[i])) | ||
{ | ||
flags |= JERRY_INIT_DEBUGGER; | ||
jerry_port_default_set_log_level (JERRY_LOG_LEVEL_DEBUG); |
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.
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.
Please remove log level setting.
@polaroi8d It's a very useful feature! |
@jiangzidong you need to pass --jerry-libc off and --jerry-debugger on to build.py. After that run jerry with --start-debug-server and pass a JS file as well. The debugger is a remote debugger, so it will listen for a connection. In the jerry-debugger/ directory there are two debugger clients: a python and a html client. Both are stand-alone. I think the best feature of JerryDebugger is that you only need a browser to do debugging, no need any other application. Run either of these clients and type help. Have fun. |
@polaroi8d this is incredibly awesome! Some (unsolicited ;) comments:
|
Well, it is certainly possible to make this less dependent on the transportation protocol. Especially the connection create / destroy and message send/receive parts. For packet format I would keep the websocket packet format since it is simple and it would control the complexity of the code (no need an ifdef around every code). Anyway I would complete the debugger first and based on its final form we could think about how to make it less dependent on network communication. Refactoring is easier in the current form when the code is not full with ifdefs. |
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.
Just a quick review on html/python parts.
jerry-debugger/jerry-client.html
Outdated
|
||
assert(i != -1); | ||
|
||
for (; i < newLength; i++) |
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 think a simple array.splice(i, 1);
is enough, no need to re-implement the functionality.
jerry-debugger/jerry-client.html
Outdated
|
||
socket.onmessage = function(event) | ||
{ | ||
message = new Uint8Array(event.data); |
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.
Shouldn't this be var message =...
?
jerry-debugger/jerry-client.html
Outdated
|
||
var length = getFormatSize(format); | ||
|
||
message = new Uint8Array(length); |
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.
Shouldn't this be var message =...
?
jerry-debugger/jerry-client.html
Outdated
return true; | ||
} | ||
|
||
if (args[1] == "b" || args[1] == "break") |
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.
Is it possible to convert these if
blocks converted into a switch-case?
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.
Definitly.
jerry-debugger/jerry-client.html
Outdated
{ | ||
var breakpoint = decodeMessage("CI", message, 1); | ||
|
||
breakpoint = functions[breakpoint[0]].offsets[breakpoint[1]]; |
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.
So... is this a breakpoint? an offset? or something else? It's a bit confusing.
jerry-debugger/jerry-client.py
Outdated
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
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.
This script will not run with python 3. We should use print functions (instead of print statement):
from __future__ import print_function
@@ -162,6 +170,11 @@ if(FEATURE_MEM_STATS) | |||
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_STATS) | |||
endif() | |||
|
|||
# Enable debugger | |||
if(FEATURE_DEBUGGER) | |||
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER) |
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.
jerry-core/debugger/jerry-debugger.h
Outdated
* check the maximum buffer size. It need to be between 64 and 256. | ||
*/ | ||
#if JERRY_DEBUGGER_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_MAX_BUFFER_SIZE > 256 | ||
#error "Please define the MAX_BUFFER_SIZE between 64 and 256." |
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.
Quote characters are not necessary
jerry-core/debugger/jerry-sha1.c
Outdated
* | ||
* This file is part of mbed TLS (https://tls.mbed.org) | ||
*/ | ||
/* |
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.
We could add a newline here.
5393ff3
to
bb137a8
Compare
Error reported by travis: |
800833a
to
69f52e2
Compare
jerry-core/debugger/jerry-sha1.c
Outdated
|
||
/* 32-bit integer manipulation macros (big endian). */ | ||
|
||
#define GET_UINT32_BE(n, b, i) \ |
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.
We need to add a JERRY_SHA1_ prefix. JERRY_SHA1_GET_UINT32_BE
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.
Okey, thanks for the review.
69f52e2
to
8fbf7c2
Compare
This is very cool of course. Love to implement this for the mbedos5 target too. +1 on making this more agnostic of the underlying transport layer. I'd probably want to run this over serial. Also, any numbers on size requirements when running with the debugger? |
@janjongboom binary sizes in bytes on ARM-32 mini-shell, static, jerry-libc: 136128 The debugger requires roughly 8K code |
Currenlty a transport layer needs to implement 4 functions: bool jerry_debugger_accept_connection (void); bool jerry_debugger_send (size_t data_size); I think it is easy to implement this over serial port. Please check jerry-debugger-ws.c and .h |
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.
LGTM
tools/build.py
Outdated
@@ -88,6 +89,10 @@ def devhelp(help): | |||
parser.print_help() | |||
sys.exit(0) | |||
|
|||
if arguments.jerry_debugger == 'ON' and arguments.jerry_libc == 'ON': | |||
print('JerryScript Debugger need the standard libc. Please use the \'--jerry-libc=off\' for it.') |
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.
No need to escape the option, simply do the following:
print(".... '--jerry-...' ....")
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 would prefer to check this somewhere in the CMake source with an error message. I think it would be better, especially if you build with the cmake only and don't want to use the script.
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.
Its true, thanks!
jerry-debugger/jerry-client-ws.py
Outdated
self.offsets = {} | ||
self.first_line = -1 | ||
|
||
if len(lines) > 0: |
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.
simply use: if lines:
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.
👍
jerry-debugger/jerry-client-ws.py
Outdated
% (self.byte_code_cp, self.source, self.name)) | ||
|
||
comma_needed = False | ||
for breakpoint in self.lines.values(): |
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.
If I understand correctly you just simply join the breakpoints as strings with a separator together. If so this would be better imho:
breakpoints = ','.join([str(breakpoint) for breakpoint in self.lines.values()])
and then you can add the breakpoints into the format string above
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.
Thanks, little more pythonic way 😺
jerry-debugger/jerry-client-ws.py
Outdated
self.offsets[offset] = breakpoint | ||
|
||
def __repr__(self): | ||
result = ('Function(byte_code_cp:0x%x, source:\'%s\', name:\'%s\', { ' |
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.
No need to escape the '
-s just use "
at the start/end of the string.
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.
Changed all of the '
to "
, thanks.
jerry-debugger/jerry-client-ws.py
Outdated
return | ||
|
||
message = pack(self.debugger.byte_order + 'BBIB' + self.debugger.idx_format, | ||
0x82, |
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.
What are these numbers?
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.
..from the RFC 6455 standard.
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.
and what do they mean? Could we have extracted as a global variable like the JERRY_ things?
|
||
if (args[1] == "help") | ||
{ | ||
appendLog("Debugger commands:\n" + |
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.
Do we really need the help? Can't we just have it as a div somewhere on the page?
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 think it feels better this way.
jerry-debugger/jerry-client-ws.html
Outdated
var length = getFormatSize(format); | ||
|
||
var message = new Uint8Array(length); | ||
|
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.
Why do we need the empty lines between the var
-s?
jerry-debugger/jerry-client-ws.html
Outdated
assert(i != -1); | ||
|
||
array.splice(i, 1); | ||
|
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.
Why do we need sooo many empty lines?
jerry-debugger/jerry-client-ws.html
Outdated
|
||
Getting help: type 'help' in the command line below.<br> | ||
|
||
<input id="command" type="text" onkeypress="return debuggerCommand(event)"> |
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.
If we always return true on keypress then maybe something like this would be a bit better:
debuggerCommand(event); return true;
jerry-debugger/jerry-client-ws.html
Outdated
|
||
<textarea id="log" rows="20" cols="80"></textarea><br> | ||
|
||
Getting help: type 'help' in the command line below.<br> |
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.
We could even have the help here :)
tools/build.py
Outdated
@@ -56,6 +56,7 @@ def devhelp(help): | |||
parser.add_argument('-j', '--jobs', metavar='N', action='store', type=int, default=multiprocessing.cpu_count() + 1, help='Allowed N build jobs at once (default: %(default)s)') | |||
parser.add_argument('--jerry-cmdline', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build jerry command line tool (%(choices)s; default: %(default)s)') | |||
parser.add_argument('--jerry-cmdline-minimal', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='build minimal version of the jerry command line tool (%(choices)s; default: %(default)s)') | |||
parser.add_argument('--jerry-debugger', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enalbe the jerry debugger (%(choices)s; default: %(default)s)') |
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.
enable the jerry debugger
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.
Thanks Robert!
tools/build.py
Outdated
@@ -88,6 +89,10 @@ def devhelp(help): | |||
parser.print_help() | |||
sys.exit(0) | |||
|
|||
if arguments.jerry_debugger == 'ON' and arguments.jerry_libc == 'ON': | |||
print('JerryScript Debugger need the standard libc. Please use the \'--jerry-libc=off\' for it.') |
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 would prefer to check this somewhere in the CMake source with an error message. I think it would be better, especially if you build with the cmake only and don't want to use the script.
docs/07.DEBUGGER.md
Outdated
this information instead of JerryScript. Hence debug information | ||
is discarded after it is transmitted to the client. | ||
|
||
The following argument makes JerryScript to wait for a client |
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.
"... makes JerryScript wait ...", without to
docs/07.DEBUGGER.md
Outdated
|
||
`--log-level 2` | ||
|
||
The HTML client can connect the IP address of the server by |
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.
"... connect to the IP address of the server with the ..."
docs/07.DEBUGGER.md
Outdated
|
||
The HTML client can connect the IP address of the server by | ||
the `connect IP-address` command. The IP address can be | ||
localhost if the server and client run on the same machine. |
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.
"... if the server and the client are running on the same machine."
jerry-core/debugger/jerry-debugger.c
Outdated
type *name_p = ((type *) recv_buffer_p) | ||
|
||
/** | ||
* Free all unreferenced byte code structures whose |
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.
which instead of whose
jerry-debugger/jerry-client-ws.py
Outdated
def arguments_parse(): | ||
parser = argparse.ArgumentParser(description='JerryScript debugger client') | ||
|
||
parser.add_argument('address', action='store', nargs='?', default='localhost:5001', help='specified a custom network setup (default: %(default)s)') |
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.
Could we improve this help message?
1ef86fb
to
8dc2010
Compare
8dc2010
to
0e3278e
Compare
fi | ||
|
||
echo "${TEST_CASE} passed" | ||
exit 0 |
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.
Missing newline
tools/runners/run-debugger-test.sh
Outdated
echo "$START_DEBUG_SERVER" | ||
eval "$START_DEBUG_SERVER" | ||
|
||
RESULT=$( (cat "${TEST_CASE}.cmd" | ${DEBUGGER_CLIENT}) 2>&1) |
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.
No space after $(
or space after 2>&1
DEBUGGER_CLIENT=$2 | ||
TEST_CASE=$3 | ||
|
||
START_DEBUG_SERVER="${JERRY} ${TEST_CASE}.js --start-debug-server &" |
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.
wait 1 second
} | ||
|
||
f1(); | ||
f2(); |
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.
Newline missing
tests/debugger/do_step.cmd
Outdated
c | ||
s | ||
bt | ||
c |
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.
Newline missing
tests/debugger/do_dump.js
Outdated
} | ||
|
||
print ("var apple"); | ||
var apple = 'apple'; |
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.
no apple :)
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.
😸
e437766
to
6209482
Compare
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.
Thanks for working on this! This is a great step forward for JerryScript in terms of usability.
Overall the patch looks very good, the bulk of my comments are just minor text issues.
docs/02.API-REFERENCE.md
Outdated
|
||
**Summary** | ||
|
||
Parse script and construct an EcmaScript function. The lexical |
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.
EcmaScript -> ECMAScript
docs/02.API-REFERENCE.md
Outdated
(usually a file name) is also passed to this function which is | ||
used by the debugger to find the source code. | ||
|
||
*Note*: Returned value must be freed with [jerry_release_value](#jerry_release_value) when it |
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.
Returned -> The returned
docs/02.API-REFERENCE.md
Outdated
|
||
```c | ||
jerry_value_t | ||
jerry_parse_named_resource (const jerry_char_t *name_p, /**< */ |
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.
Missing description of name_p?
docs/02.API-REFERENCE.md
Outdated
|
||
- `name_p` - name, usually a file name | ||
- `name_length` - size of the file name, in bytes | ||
- `source_p` - string, containing source code to parse. It must be a valid utf8 string |
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.
utf8 -> UTF-8
docs/02.API-REFERENCE.md
Outdated
- function object value, if script was parsed successfully, | ||
- thrown error, otherwise | ||
|
||
This function is the same as [jerry_parse](#jerry_parse), except a filename parameter is added. |
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.
This function is identical to jerry_parse, except that an additional filename parameter has been added.
jerry-debugger/jerry-client-ws.py
Outdated
logging.debug("Little endian machine") | ||
else: | ||
self.byte_order = ">" | ||
logging.debug("Big endian machine") |
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.
Big endian -> Big-endian
jerry-debugger/jerry-client-ws.py
Outdated
|
||
data = debugger.get_message() | ||
|
||
# Copy the ready list to the global storage |
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.
Please terminate comment with a period.
jerry-debugger/jerry-client-ws.py
Outdated
|
||
data = debugger.get_message() | ||
|
||
if not data: # Break the while loop if there is no more data |
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.
Please terminate comment with a period.
tests/debugger/do_step.cmd
Outdated
@@ -0,0 +1,8 @@ | |||
break do_step.js:25 |
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.
is the ^M intentional?
tests/debugger/do_step.cmd
Outdated
break do_step.js:25 | ||
step | ||
backtrace | ||
b do_step.js:26 |
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.
is the ^M intentional?
f1075ca
to
69b9894
Compare
@tilmannOSG updated the PR following your comments. Thanks! |
@polaroi8d Thank you! |
The debugger supports setting breakpoints, execution control (step, next, continue) and getting backtrace. The communication is websocket based, so a browser can communicate with JerryScript without any intermediate application. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected] JerryScript-DCO-1.0-Signed-off-by: Levente Orban [email protected]
69b9894
to
3595892
Compare
The debugger supports setting breakpoints, execution control (step, next, continue)
and getting backtrace. The communication is websocket based, so a browser can
communicate with JerryScript without any intermediate application.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
JerryScript-DCO-1.0-Signed-off-by: Levente Orban [email protected]