Skip to content

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
merged 1 commit into from
Feb 14, 2017

Conversation

polaroi8d
Copy link
Contributor

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]

@LaszloLango LaszloLango added the feature request Requested feature label Feb 1, 2017
@@ -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);


Copy link
Member

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 */
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added, thanks.

Copy link
Contributor

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?

Copy link
Member

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);
Copy link
Member

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?

Copy link
Member

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.

/**
* Debugger socket communication port.
*/
#define PORT 5001
Copy link
Contributor

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_?

Copy link
Contributor Author

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.

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 */
Copy link
Member

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?

Copy link
Member

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.

/**
* Process WebSocket handshake.
*
* @return true - is no error is occured
Copy link
Member

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

/*
* Send the message to the client side
*
* @return true - if the data was send successfully to the client side
Copy link
Member

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 ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks


/**
* Limited resources available for the engine, so it is important to
* check the maximum buffer size. It need to be between 64 and 256.
Copy link
Member

Choose a reason for hiding this comment

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

It needs to be

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

sha1_context_p->state[4] = 0xC3D2E1F0;
} /* jerry_sha1_init */

#define P(a, b, c, d, e, x) \
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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? ;-)

Copy link
Member

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.

Copy link
Contributor

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.


#define SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))

#define R(t) \
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

GET_UINT32_BE (W[14], data, 56);
GET_UINT32_BE (W[15], data, 60);

#define SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
Copy link
Contributor

Choose a reason for hiding this comment

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

SHA1_SHIFT

@@ -19,6 +19,8 @@
#include "ecma-helpers.h"
#include "ecma-lcache.h"
#include "ecma-property-hashmap.h"
#include "jcontext.h"
#include "jerry-debugger.h"
Copy link
Contributor

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
Copy link
Contributor

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*/
Copy link
Contributor

Choose a reason for hiding this comment

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

missing space before */

Copy link
Contributor Author

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 */
Copy link
Contributor

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?

Copy link
Member

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.

else if (!strcmp ("--start-debug-server", argv[i]))
{
flags |= JERRY_INIT_DEBUGGER;
jerry_port_default_set_log_level (JERRY_LOG_LEVEL_DEBUG);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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.

@jiangzidong
Copy link
Contributor

@polaroi8d It's a very useful feature!
Could you also please add some docs about the config/instructions/examples about "How to debug JS code in JerryScript" after this patch is landed?

@zherczeg
Copy link
Member

zherczeg commented Feb 3, 2017

@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.

@martijnthe
Copy link
Contributor

@polaroi8d this is incredibly awesome!

Some (unsolicited ;) comments:

  • Right now jerry_debugger.c requires having an IP stack in the system. IMHO, it would be better to layer this such that the underlying transport could be swapped out easily, to support devices that do not have an IP stack but want to debug over another type of transport (serial port, Bluetooth, ...) Would it make sense to add an abstraction and let the target provide it through a set of jerry-port.h functions/types?
  • I'm having a similar reaction to the protocol choice ("simplified version of Websockets"). I'd argue that it's better to keep jerry_debugger.c "transport protocol agnostic" and let the target/port take care of implementing the transport protocol (Websockets may make sense for certain targets, but not others).
  • How much does jerry-sha1.c add to the code size footprint (for example when targeting ARM CM3)?

@zherczeg
Copy link
Member

zherczeg commented Feb 3, 2017

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.

Copy link
Contributor

@galpeter galpeter left a 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.


assert(i != -1);

for (; i < newLength; i++)
Copy link
Contributor

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.


socket.onmessage = function(event)
{
message = new Uint8Array(event.data);
Copy link
Contributor

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 =...?


var length = getFormatSize(format);

message = new Uint8Array(length);
Copy link
Contributor

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 =...?

return true;
}

if (args[1] == "b" || args[1] == "break")
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitly.

{
var breakpoint = decodeMessage("CI", message, 1);

breakpoint = functions[breakpoint[0]].offsets[breakpoint[1]];
Copy link
Contributor

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.

# 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.

Copy link
Contributor

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)
Copy link
Member

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.

Copy link
Contributor Author

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.

* 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."
Copy link
Contributor

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

*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
/*
Copy link
Member

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.

@polaroi8d polaroi8d force-pushed the remote-debugger branch 2 times, most recently from 5393ff3 to bb137a8 Compare February 6, 2017 15:29
@zherczeg
Copy link
Member

zherczeg commented Feb 7, 2017

Error reported by travis:
jerry-core/debugger/jerry-debugger-ws.c:371: style(variableScope): The scope of the variable 'request_buffer_size' can be reduced.


/* 32-bit integer manipulation macros (big endian). */

#define GET_UINT32_BE(n, b, i) \
Copy link
Member

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

Copy link
Contributor Author

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.

@janjongboom
Copy link
Contributor

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?

@zherczeg
Copy link
Member

zherczeg commented Feb 7, 2017

@janjongboom binary sizes in bytes on ARM-32

mini-shell, static, jerry-libc: 136128
default-shell, static, jerry-libc: 140192
default-shell, dynamic, standard-libc: 141440
default-shell, dynamic, standard-libc, debugger: 149712

The debugger requires roughly 8K code

@zherczeg
Copy link
Member

zherczeg commented Feb 7, 2017

Currenlty a transport layer needs to implement 4 functions:

bool jerry_debugger_accept_connection (void);
void jerry_debugger_close_connection (void);

bool jerry_debugger_send (size_t data_size);
bool jerry_debugger_receive (void);

I think it is easy to implement this over serial port. Please check jerry-debugger-ws.c and .h

Copy link
Contributor

@LaszloLango LaszloLango left a 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.')
Copy link
Contributor

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-...' ....")

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its true, thanks!

self.offsets = {}
self.first_line = -1

if len(lines) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

simply use: if lines:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

% (self.byte_code_cp, self.source, self.name))

comma_needed = False
for breakpoint in self.lines.values():
Copy link
Contributor

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

Copy link
Contributor Author

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 😺

self.offsets[offset] = breakpoint

def __repr__(self):
result = ('Function(byte_code_cp:0x%x, source:\'%s\', name:\'%s\', { '
Copy link
Contributor

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.

Copy link
Contributor Author

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.

return

message = pack(self.debugger.byte_order + 'BBIB' + self.debugger.idx_format,
0x82,
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these numbers?

Copy link
Contributor Author

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.

Copy link
Contributor

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" +
Copy link
Contributor

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?

Copy link
Member

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.

var length = getFormatSize(format);

var message = new Uint8Array(length);

Copy link
Contributor

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?

assert(i != -1);

array.splice(i, 1);

Copy link
Contributor

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?


Getting help: type 'help' in the command line below.<br>

<input id="command" type="text" onkeypress="return debuggerCommand(event)">
Copy link
Contributor

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;


<textarea id="log" rows="20" cols="80"></textarea><br>

Getting help: type 'help' in the command line below.<br>
Copy link
Contributor

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)')
Copy link
Contributor

Choose a reason for hiding this comment

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

enable the jerry debugger

Copy link
Contributor Author

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.')
Copy link
Contributor

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.

@zherczeg zherczeg dismissed their stale review February 8, 2017 11:20

I am also an author.

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
Copy link
Member

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


`--log-level 2`

The HTML client can connect the IP address of the server by
Copy link
Member

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 ..."


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.
Copy link
Member

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."

type *name_p = ((type *) recv_buffer_p)

/**
* Free all unreferenced byte code structures whose
Copy link
Member

Choose a reason for hiding this comment

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

which instead of whose

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)')
Copy link
Member

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?

@polaroi8d polaroi8d force-pushed the remote-debugger branch 2 times, most recently from 1ef86fb to 8dc2010 Compare February 8, 2017 17:35
fi

echo "${TEST_CASE} passed"
exit 0
Copy link
Member

Choose a reason for hiding this comment

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

Missing newline

echo "$START_DEBUG_SERVER"
eval "$START_DEBUG_SERVER"

RESULT=$( (cat "${TEST_CASE}.cmd" | ${DEBUGGER_CLIENT}) 2>&1)
Copy link
Member

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 &"
Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

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

Newline missing

c
s
bt
c
Copy link
Member

Choose a reason for hiding this comment

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

Newline missing

}

print ("var apple");
var apple = 'apple';
Copy link
Member

Choose a reason for hiding this comment

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

no apple :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😸

@polaroi8d polaroi8d force-pushed the remote-debugger branch 2 times, most recently from e437766 to 6209482 Compare February 14, 2017 09:08
Copy link

@tilmannOSG tilmannOSG left a 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.


**Summary**

Parse script and construct an EcmaScript function. The lexical

Choose a reason for hiding this comment

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

EcmaScript -> ECMAScript

(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

Choose a reason for hiding this comment

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

Returned -> The returned


```c
jerry_value_t
jerry_parse_named_resource (const jerry_char_t *name_p, /**< */

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?


- `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

Choose a reason for hiding this comment

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

utf8 -> UTF-8

- 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.

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.

logging.debug("Little endian machine")
else:
self.byte_order = ">"
logging.debug("Big endian machine")

Choose a reason for hiding this comment

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

Big endian -> Big-endian


data = debugger.get_message()

# Copy the ready list to the global storage

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.


data = debugger.get_message()

if not data: # Break the while loop if there is no more data

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.

@@ -0,0 +1,8 @@
break do_step.js:25

Choose a reason for hiding this comment

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

is the ^M intentional?

break do_step.js:25
step
backtrace
b do_step.js:26

Choose a reason for hiding this comment

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

is the ^M intentional?

@polaroi8d polaroi8d force-pushed the remote-debugger branch 2 times, most recently from f1075ca to 69b9894 Compare February 14, 2017 11:45
@polaroi8d
Copy link
Contributor Author

@tilmannOSG updated the PR following your comments. Thanks!

@tilmannOSG
Copy link

@polaroi8d Thank you!
It seems one of the debugger tests failed in the Travis CI build, can you have a look? Once the tests are fixed I think this should be ready to go in :)

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requested feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.