Improve breakpoint generator of the debugger. (#1652)
Now the debugger generates a breakpoint for each function before its first executable statement. This allows inspecting the function arguments. Position (line and column) info is also added which simplifies finding of anonymus functions. Several tests were update to check more corner cases. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -67,19 +67,19 @@ typedef struct
|
||||
* Initialize the header of an outgoing message.
|
||||
*/
|
||||
#define JERRY_DEBUGGER_INIT_SEND_MESSAGE(message_p) \
|
||||
(message_p)->header.ws_opcode = JERRY_DEBUGGER_WEBSOCKET_FIN_BIT | JERRY_DEBUGGER_WEBSOCKET_BINARY_FRAME;
|
||||
(message_p)->header.ws_opcode = JERRY_DEBUGGER_WEBSOCKET_FIN_BIT | JERRY_DEBUGGER_WEBSOCKET_BINARY_FRAME
|
||||
|
||||
/**
|
||||
* Set the size of an outgoing message from type.
|
||||
*/
|
||||
#define JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE_FROM_TYPE(message_p, type) \
|
||||
(message_p)->header.size = (uint8_t) (sizeof (type) - sizeof (jerry_debugger_send_header_t));
|
||||
(message_p)->header.size = (uint8_t) (sizeof (type) - sizeof (jerry_debugger_send_header_t))
|
||||
|
||||
/**
|
||||
* Set the size of an outgoing message.
|
||||
*/
|
||||
#define JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE(message_p, byte_size) \
|
||||
(message_p)->header.size = (uint8_t) (byte_size);
|
||||
(message_p)->header.size = (uint8_t) (byte_size)
|
||||
|
||||
bool jerry_debugger_accept_connection (void);
|
||||
void jerry_debugger_close_connection (void);
|
||||
|
||||
@@ -496,7 +496,7 @@ jerry_debugger_send_type (jerry_debugger_header_type_t type) /**< message type *
|
||||
JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_type_t, message_type_p);
|
||||
|
||||
JERRY_DEBUGGER_INIT_SEND_MESSAGE (message_type_p);
|
||||
JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE_FROM_TYPE (message_type_p, jerry_debugger_send_type_t)
|
||||
JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE_FROM_TYPE (message_type_p, jerry_debugger_send_type_t);
|
||||
message_type_p->type = (uint8_t) type;
|
||||
|
||||
jerry_debugger_send (sizeof (jerry_debugger_send_type_t));
|
||||
@@ -595,18 +595,6 @@ jerry_debugger_send_string (uint8_t message_type, /**< message type */
|
||||
return jerry_debugger_send (sizeof (jerry_debugger_send_type_t) + string_length);
|
||||
} /* jerry_debugger_send_string */
|
||||
|
||||
/**
|
||||
* Send the function name to the debugger client.
|
||||
*/
|
||||
void
|
||||
jerry_debugger_send_function_name (const uint8_t *function_name_p, /**< function name */
|
||||
size_t function_name_length) /**< length of function name */
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);
|
||||
|
||||
jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME, function_name_p, function_name_length);
|
||||
} /* jerry_debugger_send_function_name */
|
||||
|
||||
/**
|
||||
* Send the function compressed pointer to the debugger client.
|
||||
*
|
||||
@@ -632,4 +620,27 @@ jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, /**< message
|
||||
return jerry_debugger_send (sizeof (jerry_debugger_send_byte_code_cp_t));
|
||||
} /* jerry_debugger_send_function_cp */
|
||||
|
||||
/**
|
||||
* Send function data to the debugger client.
|
||||
*
|
||||
* @return true - if the data sent successfully to the debugger client,
|
||||
* false - otherwise
|
||||
*/
|
||||
bool
|
||||
jerry_debugger_send_parse_function (uint32_t line, /**< line */
|
||||
uint32_t column) /**< column */
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);
|
||||
|
||||
JERRY_DEBUGGER_SEND_BUFFER_AS (jerry_debugger_send_parse_function_t, message_parse_function_p);
|
||||
|
||||
JERRY_DEBUGGER_INIT_SEND_MESSAGE (message_parse_function_p);
|
||||
JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE_FROM_TYPE (message_parse_function_p, jerry_debugger_send_parse_function_t);
|
||||
message_parse_function_p->type = JERRY_DEBUGGER_PARSE_FUNCTION;
|
||||
memcpy (message_parse_function_p->line, &line, sizeof (uint32_t));
|
||||
memcpy (message_parse_function_p->column, &column, sizeof (uint32_t));
|
||||
|
||||
return jerry_debugger_send (sizeof (jerry_debugger_send_parse_function_t));
|
||||
} /* jerry_debugger_send_parse_function */
|
||||
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -172,6 +172,17 @@ typedef struct
|
||||
uint8_t string[JERRY_DEBUGGER_SEND_MAX (uint8_t)]; /**< string data */
|
||||
} jerry_debugger_send_string_t;
|
||||
|
||||
/**
|
||||
* Outgoing message: uint32 value.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
jerry_debugger_send_header_t header; /**< message header */
|
||||
uint8_t type; /**< type of the message */
|
||||
uint8_t line[sizeof (uint32_t)]; /**< value data */
|
||||
uint8_t column[sizeof (uint32_t)]; /**< value data */
|
||||
} jerry_debugger_send_parse_function_t;
|
||||
|
||||
/**
|
||||
* Outgoing message: byte code compressed pointer.
|
||||
*/
|
||||
@@ -277,8 +288,8 @@ void jerry_debugger_send_type (jerry_debugger_header_type_t type);
|
||||
bool jerry_debugger_send_configuration (uint8_t max_message_size);
|
||||
void jerry_debugger_send_data (jerry_debugger_header_type_t type, const void *data, size_t size);
|
||||
bool jerry_debugger_send_string (uint8_t message_type, const uint8_t *string_p, size_t string_length);
|
||||
void jerry_debugger_send_function_name (const uint8_t *function_name_p, size_t function_name_length);
|
||||
bool jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, ecma_compiled_code_t *compiled_code_p);
|
||||
bool jerry_debugger_send_parse_function (uint32_t line, uint32_t column);
|
||||
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
|
||||
@@ -83,15 +83,15 @@ typedef struct
|
||||
#endif /* !CONFIG_DISABLE_REGEXP_BUILTIN */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
uint16_t debugger_message_delay; /**< call receive message when reaches zero */
|
||||
uint16_t debugger_receive_buffer_offset; /**< receive buffer offset */
|
||||
uint8_t debugger_send_buffer[JERRY_DEBUGGER_MAX_BUFFER_SIZE]; /**< buffer for sending messages */
|
||||
uint8_t debugger_receive_buffer[JERRY_DEBUGGER_MAX_BUFFER_SIZE]; /**< buffer for receiving messages */
|
||||
vm_frame_ctx_t *debugger_stop_context; /**< stop only if the current context is equal to this context */
|
||||
jmem_cpointer_t debugger_byte_code_free_head; /**< head of byte code free linked list */
|
||||
jmem_cpointer_t debugger_byte_code_free_tail; /**< tail of byte code free linked list */
|
||||
int debugger_connection; /**< hold the file descriptor for socket communication */
|
||||
uint8_t debugger_flags; /**< debugger flags */
|
||||
vm_frame_ctx_t *debugger_stop_context; /**< stop only if the current context is equal to this context */
|
||||
uint8_t debugger_message_delay; /**< call receive message when reaches zero */
|
||||
uint16_t debugger_receive_buffer_offset; /**< receive buffer offset */
|
||||
int debugger_connection; /**< holds the file descriptor of the socket communication */
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
#ifdef JMEM_STATS
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#define PARSER_ARGUMENTS_NOT_NEEDED 0x04000u
|
||||
#define PARSER_LEXICAL_ENV_NEEDED 0x08000u
|
||||
#define PARSER_HAS_LATE_LIT_INIT 0x10000u
|
||||
#define PARSER_DEBUGGER_BREAKPOINT_APPENDED 0x20000u
|
||||
|
||||
/* Expression parsing flags. */
|
||||
#define PARSE_EXPR 0x00
|
||||
|
||||
@@ -315,7 +315,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
parser_line_counter_t ident_line_counter = context_p->line;
|
||||
parser_line_counter_t ident_line_counter = context_p->token.line;
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_VAR;
|
||||
@@ -327,26 +327,23 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|
||||
if (context_p->token.type == LEXER_ASSIGN)
|
||||
{
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
&& ident_line_counter != context_p->last_breakpoint_line)
|
||||
{
|
||||
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);
|
||||
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
|
||||
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
|
||||
|
||||
cbc_argument_t last_cbc = context_p->last_cbc;
|
||||
context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;
|
||||
cbc_argument_t last_cbc = context_p->last_cbc;
|
||||
context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;
|
||||
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, ident_line_counter);
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, ident_line_counter);
|
||||
|
||||
context_p->last_cbc_opcode = CBC_PUSH_LITERAL;
|
||||
context_p->last_cbc = last_cbc;
|
||||
context_p->last_cbc_opcode = CBC_PUSH_LITERAL;
|
||||
context_p->last_cbc = last_cbc;
|
||||
|
||||
context_p->last_breakpoint_line = ident_line_counter;
|
||||
}
|
||||
context_p->last_breakpoint_line = ident_line_counter;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -381,6 +378,11 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
|
||||
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
parser_line_counter_t debugger_line = context_p->token.line;
|
||||
parser_line_counter_t debugger_column = context_p->token.column;
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
|
||||
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
|
||||
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
|
||||
@@ -404,8 +406,13 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
jerry_debugger_send_function_name (name_p->u.char_p,
|
||||
name_p->prop.length);
|
||||
jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,
|
||||
name_p->u.char_p,
|
||||
name_p->prop.length);
|
||||
|
||||
/* Reset token position for the function. */
|
||||
context_p->token.line = debugger_line;
|
||||
context_p->token.column = debugger_column;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -1618,6 +1625,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED;
|
||||
context_p->last_breakpoint_line = 0;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -1656,22 +1664,23 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
|| context_p->token.type == LEXER_LEFT_SQUARE
|
||||
|| context_p->token.type == LEXER_DOT)
|
||||
{
|
||||
/* The string is part of an expression statement. */
|
||||
context_p->status_flags = status_flags;
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
|
||||
&& context_p->line != context_p->last_breakpoint_line)
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
JERRY_ASSERT (context_p->last_breakpoint_line == 0);
|
||||
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->line);
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);
|
||||
|
||||
context_p->last_breakpoint_line = context_p->line;
|
||||
context_p->last_breakpoint_line = context_p->token.line;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
/* The string is part of an expression statement. */
|
||||
context_p->status_flags = status_flags;
|
||||
|
||||
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
|
||||
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
|
||||
/* The extra_value is used for saving the token. */
|
||||
@@ -1723,7 +1732,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
|
||||
&& context_p->line != context_p->last_breakpoint_line
|
||||
&& context_p->token.line != context_p->last_breakpoint_line
|
||||
&& context_p->token.type != LEXER_SEMICOLON
|
||||
&& context_p->token.type != LEXER_LEFT_BRACE
|
||||
&& context_p->token.type != LEXER_RIGHT_BRACE
|
||||
@@ -1735,9 +1744,9 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->line);
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);
|
||||
|
||||
context_p->last_breakpoint_line = context_p->line;
|
||||
context_p->last_breakpoint_line = context_p->token.line;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
|
||||
@@ -1251,8 +1251,8 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
uint16_t initialized_var_end;
|
||||
uint16_t const_literal_end;
|
||||
parser_mem_page_t *page_p;
|
||||
parser_mem_page_t *last_page_p = context_p->byte_code.last_p;
|
||||
size_t last_position = context_p->byte_code.last_position;
|
||||
parser_mem_page_t *last_page_p;
|
||||
size_t last_position;
|
||||
size_t offset;
|
||||
size_t length;
|
||||
size_t total_size;
|
||||
@@ -1273,6 +1273,18 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
JERRY_ASSERT (context_p->literal_count <= PARSER_MAXIMUM_NUMBER_OF_LITERALS);
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
&& !(context_p->status_flags & PARSER_DEBUGGER_BREAKPOINT_APPENDED))
|
||||
{
|
||||
/* Always provide at least one breakpoint. */
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->token.line);
|
||||
|
||||
context_p->last_breakpoint_line = context_p->token.line;
|
||||
}
|
||||
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
&& context_p->breakpoint_info_count > 0)
|
||||
{
|
||||
@@ -1281,6 +1293,9 @@ parser_post_processing (parser_context_t *context_p) /**< context */
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
last_page_p = context_p->byte_code.last_p;
|
||||
last_position = context_p->byte_code.last_position;
|
||||
|
||||
initializers_length = parser_compute_indicies (context_p,
|
||||
&ident_end,
|
||||
&uninitialized_var_end,
|
||||
@@ -1897,7 +1912,6 @@ parser_parse_source (const uint8_t *source_p, /**< valid UTF-8 source code */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
context.breakpoint_info_count = 0;
|
||||
context.last_breakpoint_line = 0;
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
PARSER_TRY (context.try_buffer)
|
||||
@@ -2047,22 +2061,8 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
#endif /* PARSER_DUMP_BYTE_CODE */
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
/* This option has a high memory and performance costs,
|
||||
* but it is necessary for executing eval operations by the debugger. */
|
||||
context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED | PARSER_NO_REG_STORE;
|
||||
|
||||
if (context_p->line != context_p->last_breakpoint_line)
|
||||
{
|
||||
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
|
||||
parser_flush_cbc (context_p);
|
||||
|
||||
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST, context_p->line);
|
||||
|
||||
context_p->last_breakpoint_line = context_p->line;
|
||||
}
|
||||
}
|
||||
parser_line_counter_t debugger_line = context_p->token.line;
|
||||
parser_line_counter_t debugger_column = context_p->token.column;
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
lexer_next_token (context_p);
|
||||
@@ -2078,8 +2078,9 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
{
|
||||
jerry_debugger_send_function_name (context_p->lit_object.literal_p->u.char_p,
|
||||
context_p->lit_object.literal_p->prop.length);
|
||||
jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,
|
||||
context_p->lit_object.literal_p->u.char_p,
|
||||
context_p->lit_object.literal_p->prop.length);
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -2101,9 +2102,12 @@ parser_parse_function (parser_context_t *context_p, /**< context */
|
||||
}
|
||||
|
||||
#ifdef JERRY_DEBUGGER
|
||||
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
|
||||
&& jerry_debugger_send_parse_function (debugger_line, debugger_column))
|
||||
{
|
||||
jerry_debugger_send_type (JERRY_DEBUGGER_PARSE_FUNCTION);
|
||||
/* This option has a high memory and performance costs,
|
||||
* but it is necessary for executing eval operations by the debugger. */
|
||||
context_p->status_flags |= PARSER_LEXICAL_ENV_NEEDED | PARSER_NO_REG_STORE;
|
||||
}
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
|
||||
@@ -2317,6 +2321,8 @@ parser_append_breakpoint_info (parser_context_t *context_p, /**< context */
|
||||
{
|
||||
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);
|
||||
|
||||
context_p->status_flags |= PARSER_DEBUGGER_BREAKPOINT_APPENDED;
|
||||
|
||||
if (context_p->breakpoint_info_count >= JERRY_DEBUGGER_SEND_MAX (parser_list_t))
|
||||
{
|
||||
parser_send_breakpoints (context_p, type);
|
||||
|
||||
@@ -251,9 +251,15 @@ function DebuggerClient(address)
|
||||
|
||||
result += ":" + breakpoint.line;
|
||||
|
||||
if (breakpoint.func.name)
|
||||
if (breakpoint.func.is_func)
|
||||
{
|
||||
result += " (in " + breakpoint.func.name + ")";
|
||||
result += " (in "
|
||||
+ (breakpoint.func.name ? breakpoint.func.name : "function")
|
||||
+ "() at line:"
|
||||
+ breakpoint.func.line
|
||||
+ ", col:"
|
||||
+ breakpoint.func.column
|
||||
+ ")";
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -464,6 +470,31 @@ function DebuggerClient(address)
|
||||
socket.send(message);
|
||||
}
|
||||
|
||||
function releaseFunction(message)
|
||||
{
|
||||
var byte_code_cp = decodeMessage("C", message, 1)[0];
|
||||
var func = functions[byte_code_cp];
|
||||
|
||||
for (var i in func.lines)
|
||||
{
|
||||
lineList.delete(i, func);
|
||||
|
||||
var breakpoint = func.lines[i];
|
||||
|
||||
assert(i == breakpoint.line);
|
||||
|
||||
if (breakpoint.activeIndex >= 0)
|
||||
{
|
||||
delete activeBreakpoints[breakpoint.activeIndex];
|
||||
}
|
||||
}
|
||||
|
||||
delete functions[byte_code_cp];
|
||||
|
||||
message[0] = JERRY_DEBUGGER_FREE_BYTE_CODE_CP;
|
||||
socket.send(message);
|
||||
}
|
||||
|
||||
this.encodeMessage = encodeMessage;
|
||||
|
||||
function ParseSource()
|
||||
@@ -473,8 +504,14 @@ function DebuggerClient(address)
|
||||
var sourceName = "";
|
||||
var sourceNameData = null;
|
||||
var functionName = null;
|
||||
var stack = [ { name: "", source: "", lines: [], offsets: [] } ];
|
||||
var newFunctions = [ ];
|
||||
var stack = [{ is_func: false,
|
||||
line: 1,
|
||||
column: 1,
|
||||
name: "",
|
||||
source: "",
|
||||
lines: [],
|
||||
offsets: [] }];
|
||||
var newFunctions = { };
|
||||
|
||||
this.receive = function(message)
|
||||
{
|
||||
@@ -520,7 +557,12 @@ function DebuggerClient(address)
|
||||
|
||||
case JERRY_DEBUGGER_PARSE_FUNCTION:
|
||||
{
|
||||
stack.push({ name: cesu8ToString(functionName),
|
||||
position = decodeMessage("II", message, 1);
|
||||
|
||||
stack.push({ is_func: true,
|
||||
line: position[0],
|
||||
column: position[1],
|
||||
name: cesu8ToString(functionName),
|
||||
source: source,
|
||||
sourceName: sourceName,
|
||||
lines: [],
|
||||
@@ -563,7 +605,7 @@ function DebuggerClient(address)
|
||||
lines = {}
|
||||
offsets = {}
|
||||
|
||||
func.firstLine = (func.lines.length > 0) ? func.lines[0] : -1;
|
||||
func.firstBreakpointLine = func.lines[0];
|
||||
|
||||
for (var i = 0; i < func.lines.length; i++)
|
||||
{
|
||||
@@ -576,7 +618,7 @@ function DebuggerClient(address)
|
||||
func.lines = lines;
|
||||
func.offsets = offsets;
|
||||
|
||||
newFunctions.push(func);
|
||||
newFunctions[func.byte_code_cp] = func;
|
||||
|
||||
if (stack.length > 0)
|
||||
{
|
||||
@@ -588,6 +630,21 @@ function DebuggerClient(address)
|
||||
break;
|
||||
}
|
||||
|
||||
case JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP:
|
||||
{
|
||||
var byte_code_cp = decodeMessage("C", message, 1)[0];
|
||||
|
||||
if (byte_code_cp in newFunctions)
|
||||
{
|
||||
delete newFunctions[byte_code_cp];
|
||||
}
|
||||
else
|
||||
{
|
||||
releaseFunction(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
abortConnection("unexpected message.");
|
||||
@@ -595,11 +652,11 @@ function DebuggerClient(address)
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < newFunctions.length; i++)
|
||||
for (var i in newFunctions)
|
||||
{
|
||||
var func = newFunctions[i];
|
||||
|
||||
functions[func.byte_code_cp] = func
|
||||
functions[i] = func;
|
||||
|
||||
for (var j in func.lines)
|
||||
{
|
||||
@@ -667,27 +724,7 @@ function DebuggerClient(address)
|
||||
|
||||
case JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP:
|
||||
{
|
||||
var byte_code_cp = decodeMessage("C", message, 1)[0];
|
||||
var func = functions[byte_code_cp];
|
||||
|
||||
for (var i in func.lines)
|
||||
{
|
||||
lineList.delete(i, func);
|
||||
|
||||
var breakpoint = func.lines[i];
|
||||
|
||||
assert(i == breakpoint.line);
|
||||
|
||||
if (breakpoint.activeIndex >= 0)
|
||||
{
|
||||
delete activeBreakpoints[breakpoint.activeIndex];
|
||||
}
|
||||
}
|
||||
|
||||
delete functions[byte_code_cp];
|
||||
|
||||
message[0] = JERRY_DEBUGGER_FREE_BYTE_CODE_CP;
|
||||
socket.send(message);
|
||||
releaseFunction(message);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -828,9 +865,9 @@ function DebuggerClient(address)
|
||||
{
|
||||
var func = functions[i];
|
||||
|
||||
if (func.name == str && func.firstLine >= 0)
|
||||
if (func.name == str)
|
||||
{
|
||||
insertBreakpoint(func.lines[func.firstLine]);
|
||||
insertBreakpoint(func.lines[func.firstBreakpointLine]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -975,7 +1012,16 @@ function DebuggerClient(address)
|
||||
sourceName = "<unknown>";
|
||||
}
|
||||
|
||||
appendLog("Function 0x" + Number(i).toString(16) + " '" + func.name + "' at " + sourceName + ":" + func.firstLine);
|
||||
appendLog("Function 0x"
|
||||
+ Number(i).toString(16)
|
||||
+ " '"
|
||||
+ func.name
|
||||
+ "' at "
|
||||
+ sourceName
|
||||
+ ":"
|
||||
+ func.line
|
||||
+ ","
|
||||
+ func.column);
|
||||
|
||||
for (var j in func.lines)
|
||||
{
|
||||
@@ -986,7 +1032,7 @@ function DebuggerClient(address)
|
||||
active = " (active: " + func.lines[j].active + ")";
|
||||
}
|
||||
|
||||
appendLog(" Breatpoint line: " + j + " at memory offset: " + func.lines[j].offset + active);
|
||||
appendLog(" Breakpoint line: " + j + " at memory offset: " + func.lines[j].offset + active);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,13 @@ class JerryBreakpoint(object):
|
||||
|
||||
result += ":%d" % (self.line)
|
||||
|
||||
if self.function.name:
|
||||
result += " (in %s)" % (self.function.name)
|
||||
if self.function.is_func:
|
||||
result += " (in "
|
||||
if self.function.name:
|
||||
result += self.function.name
|
||||
else:
|
||||
result += "function"
|
||||
result += "() at line:%d, col:%d)" % (self.function.line, self.function.column)
|
||||
return result
|
||||
|
||||
def __repr__(self):
|
||||
@@ -106,17 +111,17 @@ class JerryBreakpoint(object):
|
||||
|
||||
class JerryFunction(object):
|
||||
|
||||
def __init__(self, byte_code_cp, source, source_name, name, lines, offsets):
|
||||
def __init__(self, is_func, byte_code_cp, source, source_name, line, column, name, lines, offsets):
|
||||
self.is_func = is_func
|
||||
self.byte_code_cp = byte_code_cp
|
||||
self.source = source
|
||||
self.source_name = source_name
|
||||
self.name = name
|
||||
self.lines = {}
|
||||
self.offsets = {}
|
||||
self.first_line = -1
|
||||
|
||||
if lines:
|
||||
self.first_line = lines[0]
|
||||
self.line = line
|
||||
self.column = column
|
||||
self.first_breakpoint_line = lines[0]
|
||||
|
||||
for i in range(len(lines)):
|
||||
line = lines[i]
|
||||
@@ -126,8 +131,8 @@ class JerryFunction(object):
|
||||
self.offsets[offset] = breakpoint
|
||||
|
||||
def __repr__(self):
|
||||
result = ("Function(byte_code_cp:0x%x, source_name:\"%s\", name:\"%s\", { "
|
||||
% (self.byte_code_cp, self.source_name, self.name))
|
||||
result = ("Function(byte_code_cp:0x%x, source_name:\"%s\", name:\"%s\", line:%d, column: %d { "
|
||||
% (self.byte_code_cp, self.source_name, self.name, self.line, self.column))
|
||||
|
||||
result += ','.join([str(breakpoint) for breakpoint in self.lines.values()])
|
||||
|
||||
@@ -465,6 +470,15 @@ class JerryDebugger(object):
|
||||
breakpoint.offset)
|
||||
self.send_message(message)
|
||||
|
||||
def send_bytecode_cp(self, byte_code_cp):
|
||||
message = struct.pack(self.byte_order + "BBIB" + self.cp_format,
|
||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||
WEBSOCKET_FIN_BIT + 1 + self.cp_size,
|
||||
0,
|
||||
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
||||
byte_code_cp)
|
||||
self.send_message(message)
|
||||
|
||||
def send_command(self, command):
|
||||
message = struct.pack(self.byte_order + "BBIB",
|
||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||
@@ -510,7 +524,11 @@ def parse_source(debugger, data):
|
||||
source_code = ""
|
||||
source_code_name = ""
|
||||
function_name = ""
|
||||
stack = [{"lines": [], "offsets": [], "name": ""}]
|
||||
stack = [{"line": 1,
|
||||
"column": 1,
|
||||
"name": "",
|
||||
"lines": [],
|
||||
"offsets": []}]
|
||||
new_function_list = {}
|
||||
|
||||
while True:
|
||||
@@ -537,8 +555,14 @@ def parse_source(debugger, data):
|
||||
|
||||
elif buffer_type == JERRY_DEBUGGER_PARSE_FUNCTION:
|
||||
logging.debug("Source name: %s, function name: %s" % (source_code_name, function_name))
|
||||
|
||||
position = struct.unpack(debugger.byte_order + debugger.idx_format + debugger.idx_format,
|
||||
data[3: 3 + 4 + 4])
|
||||
|
||||
stack.append({"source": source_code,
|
||||
"source_name": source_code_name,
|
||||
"line": position[0],
|
||||
"column": position[1],
|
||||
"name": function_name,
|
||||
"lines": [],
|
||||
"offsets": []})
|
||||
@@ -572,9 +596,12 @@ def parse_source(debugger, data):
|
||||
func_desc["source"] = source_code
|
||||
func_desc["source_name"] = source_code_name
|
||||
|
||||
function = JerryFunction(byte_code_cp,
|
||||
function = JerryFunction(len(stack) != 0,
|
||||
byte_code_cp,
|
||||
func_desc["source"],
|
||||
func_desc["source_name"],
|
||||
func_desc["line"],
|
||||
func_desc["column"],
|
||||
func_desc["name"],
|
||||
func_desc["lines"],
|
||||
func_desc["offsets"])
|
||||
@@ -585,6 +612,17 @@ def parse_source(debugger, data):
|
||||
logging.debug("Parse completed.")
|
||||
break
|
||||
|
||||
elif buffer_type == JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP:
|
||||
# Redefined functions are dropped during parsing.
|
||||
byte_code_cp = struct.unpack(debugger.byte_order + debugger.cp_format,
|
||||
data[3: 3 + debugger.cp_size])[0]
|
||||
|
||||
if byte_code_cp in new_function_list:
|
||||
del new_function_list[byte_code_cp]
|
||||
debugger.send_bytecode_cp(byte_code_cp)
|
||||
else:
|
||||
release_function(debugger, data)
|
||||
|
||||
else:
|
||||
logging.error("Parser error!")
|
||||
return
|
||||
@@ -612,14 +650,7 @@ def release_function(debugger, data):
|
||||
|
||||
del debugger.function_list[byte_code_cp]
|
||||
|
||||
message = struct.pack(debugger.byte_order + "BBIB" + debugger.cp_format,
|
||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||
WEBSOCKET_FIN_BIT + 1 + debugger.cp_size,
|
||||
0,
|
||||
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
||||
byte_code_cp)
|
||||
|
||||
debugger.send_message(message)
|
||||
debugger.send_bytecode_cp(byte_code_cp)
|
||||
|
||||
logging.debug("Function {0x%x} byte-code released" % byte_code_cp)
|
||||
|
||||
@@ -656,10 +687,7 @@ def set_breakpoint(debugger, string):
|
||||
else:
|
||||
for function in debugger.function_list.values():
|
||||
if function.name == string:
|
||||
if function.first_line >= 0:
|
||||
enable_breakpoint(debugger, function.lines[function.first_line])
|
||||
else:
|
||||
print("Function %s has no breakpoints." % (string))
|
||||
enable_breakpoint(debugger, function.lines[function.first_breakpoint_line])
|
||||
found = True
|
||||
|
||||
if not found:
|
||||
|
||||
@@ -3,7 +3,10 @@ n
|
||||
next
|
||||
step
|
||||
next
|
||||
n
|
||||
s
|
||||
bt
|
||||
n
|
||||
n
|
||||
s
|
||||
backtrace
|
||||
c
|
||||
|
||||
@@ -3,12 +3,18 @@ Stopped at tests/debugger/do_backtrace.js:15
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:28
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:37
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:40
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:30 (in test)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:32 (in test)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:33 (in test)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:21 (in foo)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_backtrace.js:21 (in foo)
|
||||
Frame 1: tests/debugger/do_backtrace.js:33 (in test)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:32 (in test() at line:30, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_backtrace.js:23 (in foo() at line:21, col:1)
|
||||
Frame 1: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
|
||||
Frame 2: tests/debugger/do_backtrace.js:40
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:24 (in foo() at line:21, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:18 (in f4() at line:17, col:1)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_backtrace.js:18 (in f4() at line:17, col:1)
|
||||
Frame 1: tests/debugger/do_backtrace.js:25 (in foo() at line:21, col:1)
|
||||
Frame 2: tests/debugger/do_backtrace.js:33 (in test() at line:30, col:1)
|
||||
Frame 3: tests/debugger/do_backtrace.js:40
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
break do_break.js:24
|
||||
b do_break.js:27
|
||||
b do_break.js:17
|
||||
break do_break.js:51
|
||||
b do_break.js:36
|
||||
break f
|
||||
list
|
||||
delete 2
|
||||
next
|
||||
c
|
||||
delete 1
|
||||
list
|
||||
c
|
||||
continue
|
||||
c
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_break.js:15
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_break.js:24 (in test)
|
||||
(jerry-debugger) Breakpoint 2 at tests/debugger/do_break.js:27 (in test)
|
||||
(jerry-debugger) Breakpoint 3 at tests/debugger/do_break.js:17
|
||||
(jerry-debugger) 1: tests/debugger/do_break.js:24 (in test)
|
||||
2: tests/debugger/do_break.js:27 (in test)
|
||||
3: tests/debugger/do_break.js:17
|
||||
(jerry-debugger) (jerry-debugger) Stopped at breakpoint:3 tests/debugger/do_break.js:17
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_break.js:51
|
||||
(jerry-debugger) Breakpoint 2 at tests/debugger/do_break.js:36 (in test() at line:20, col:1)
|
||||
(jerry-debugger) Breakpoint 3 at tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
Breakpoint 4 at tests/debugger/do_break.js:45 (in f() at line:43, col:1)
|
||||
(jerry-debugger) 1: tests/debugger/do_break.js:51
|
||||
2: tests/debugger/do_break.js:36 (in test() at line:20, col:1)
|
||||
3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Stopped at breakpoint:1 tests/debugger/do_break.js:51
|
||||
(jerry-debugger) (jerry-debugger) 2: tests/debugger/do_break.js:36 (in test() at line:20, col:1)
|
||||
3: tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
4: tests/debugger/do_break.js:45 (in f() at line:43, col:1)
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Stopped at breakpoint:2 tests/debugger/do_break.js:36 (in test() at line:20, col:1)
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Stopped at breakpoint:3 tests/debugger/do_break.js:33 (in f() at line:31, col:3)
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
+28
-10
@@ -17,17 +17,35 @@ print("break test");
|
||||
print ("var cat");
|
||||
var cat = 'cat';
|
||||
|
||||
function test()
|
||||
function test(x)
|
||||
{
|
||||
print("function test");
|
||||
foo();
|
||||
var a = 3;
|
||||
var b = 5;
|
||||
var c = a + b;
|
||||
global_var = c;
|
||||
return c;
|
||||
function f() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function f() {
|
||||
/* Again. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
function f() {
|
||||
/* And again. */
|
||||
return 2;
|
||||
}
|
||||
|
||||
print("function test");
|
||||
var a = 3;
|
||||
var b = 5, c = a + b;
|
||||
global_var = f();
|
||||
return c;
|
||||
}
|
||||
|
||||
function f() {
|
||||
/* And again. */
|
||||
}
|
||||
|
||||
var
|
||||
x =
|
||||
1;
|
||||
x =
|
||||
1;
|
||||
|
||||
test(x);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
continue
|
||||
@@ -0,0 +1,3 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_continue.js:16
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// 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.
|
||||
|
||||
/* Empty file. */
|
||||
@@ -2,10 +2,10 @@ Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_delete_all.js:15
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_delete_all.js:17
|
||||
(jerry-debugger) Breakpoint 2 at tests/debugger/do_delete_all.js:18
|
||||
(jerry-debugger) Breakpoint 3 at tests/debugger/do_delete_all.js:21 (in delete_test)
|
||||
(jerry-debugger) Breakpoint 3 at tests/debugger/do_delete_all.js:21 (in delete_test() at line:20, col:1)
|
||||
(jerry-debugger) 1: tests/debugger/do_delete_all.js:17
|
||||
2: tests/debugger/do_delete_all.js:18
|
||||
3: tests/debugger/do_delete_all.js:21 (in delete_test)
|
||||
3: tests/debugger/do_delete_all.js:21 (in delete_test() at line:20, col:1)
|
||||
(jerry-debugger) (jerry-debugger) Stopped at tests/debugger/do_delete_all.js:16
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
step
|
||||
dump
|
||||
c
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_dump.js:15
|
||||
(jerry-debugger) Stopped at tests/debugger/do_dump.js:42
|
||||
(jerry-debugger) {68: Function(byte_code_cp:0x44, source_name:"tests/debugger/do_dump.js", name:"f4", { Breakpoint(line:32, offset:17, active_index:-1),Breakpoint(line:31, offset:16, active_index:-1) }),
|
||||
79: Function(byte_code_cp:0x4f, source_name:"tests/debugger/do_dump.js", name:"f1", { Breakpoint(line:17, offset:21, active_index:-1),Breakpoint(line:27, offset:22, active_index:-1) }),
|
||||
102: Function(byte_code_cp:0x66, source_name:"tests/debugger/do_dump.js", name:"f2", { Breakpoint(line:19, offset:14, active_index:-1),Breakpoint(line:21, offset:15, active_index:-1) }),
|
||||
105: Function(byte_code_cp:0x69, source_name:"tests/debugger/do_dump.js", name:"foo", { Breakpoint(line:35, offset:22, active_index:-1),Breakpoint(line:37, offset:23, active_index:-1),Breakpoint(line:38, offset:28, active_index:-1),Breakpoint(line:39, offset:33, active_index:-1) }),
|
||||
125: Function(byte_code_cp:0x7d, source_name:"tests/debugger/do_dump.js", name:"f3", { Breakpoint(line:22, offset:25, active_index:-1),Breakpoint(line:23, offset:30, active_index:-1) }),
|
||||
131: Function(byte_code_cp:0x83, source_name:"tests/debugger/do_dump.js", name:"", { Breakpoint(line:57, offset:63, active_index:-1),Breakpoint(line:42, offset:54, active_index:-1),Breakpoint(line:43, offset:59, active_index:-1),Breakpoint(line:60, offset:68, active_index:-1),Breakpoint(line:15, offset:49, active_index:-1) }),
|
||||
154: Function(byte_code_cp:0x9a, source_name:"tests/debugger/do_dump.js", name:"test", { Breakpoint(line:45, offset:28, active_index:-1),Breakpoint(line:47, offset:29, active_index:-1),Breakpoint(line:48, offset:34, active_index:-1),Breakpoint(line:49, offset:38, active_index:-1),Breakpoint(line:50, offset:43, active_index:-1),Breakpoint(line:51, offset:48, active_index:-1),Breakpoint(line:52, offset:54, active_index:-1),Breakpoint(line:53, offset:58, active_index:-1) })}
|
||||
(jerry-debugger) {60: Function(byte_code_cp:0x3c, source_name:"tests/debugger/do_dump.js", name:"", line:54, column: 8 { Breakpoint(line:58, offset:12, active_index:-1) }),
|
||||
64: Function(byte_code_cp:0x40, source_name:"tests/debugger/do_dump.js", name:"func", line:34, column: 1 { Breakpoint(line:36, offset:16, active_index:-1) }),
|
||||
79: Function(byte_code_cp:0x4f, source_name:"tests/debugger/do_dump.js", name:"f1", line:17, column: 1 { Breakpoint(line:30, offset:23, active_index:-1) }),
|
||||
100: Function(byte_code_cp:0x64, source_name:"tests/debugger/do_dump.js", name:"g2", line:26, column: 5 { Breakpoint(line:26, offset:12, active_index:-1) }),
|
||||
102: Function(byte_code_cp:0x66, source_name:"tests/debugger/do_dump.js", name:"f2", line:19, column: 3 { Breakpoint(line:27, offset:26, active_index:-1) }),
|
||||
109: Function(byte_code_cp:0x6d, source_name:"tests/debugger/do_dump.js", name:"g1", line:21, column: 5 { Breakpoint(line:22, offset:18, active_index:-1),Breakpoint(line:23, offset:23, active_index:-1) }),
|
||||
128: Function(byte_code_cp:0x80, source_name:"tests/debugger/do_dump.js", name:"", line:1, column: 1 { Breakpoint(line:41, offset:47, active_index:-1),Breakpoint(line:51, offset:57, active_index:-1),Breakpoint(line:49, offset:52, active_index:-1),Breakpoint(line:54, offset:62, active_index:-1),Breakpoint(line:15, offset:42, active_index:-1) })}
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
+29
-31
@@ -16,45 +16,43 @@ print("first line of code");
|
||||
|
||||
function f1()
|
||||
{
|
||||
function f2()
|
||||
{
|
||||
return function f3() {
|
||||
a = 4;
|
||||
print("funciton f3");
|
||||
};
|
||||
}
|
||||
function f2()
|
||||
{
|
||||
function g1() {
|
||||
a = 4;
|
||||
return print("funciton f3");
|
||||
}
|
||||
|
||||
x =
|
||||
6;
|
||||
function g2() { }
|
||||
}
|
||||
|
||||
var
|
||||
x =
|
||||
6;
|
||||
}
|
||||
|
||||
function f4() {
|
||||
print("function f4");
|
||||
function func() {
|
||||
'use strict';
|
||||
'use stri' + 'ct';
|
||||
}
|
||||
|
||||
function foo()
|
||||
{
|
||||
print("function foo");
|
||||
var tmp = 4;
|
||||
f4();
|
||||
{
|
||||
print("Y");
|
||||
}
|
||||
}
|
||||
|
||||
print ("var cat");
|
||||
var cat = 'cat';
|
||||
|
||||
function test()
|
||||
{
|
||||
print("function test");
|
||||
foo();
|
||||
var a = 3;
|
||||
var b = 5;
|
||||
var c = a + b;
|
||||
global_var = c;
|
||||
return c;
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
var
|
||||
x =
|
||||
1;
|
||||
x =
|
||||
1,
|
||||
y =
|
||||
2
|
||||
|
||||
test();
|
||||
test = function
|
||||
(
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,5 +7,7 @@ e b
|
||||
next
|
||||
e b
|
||||
e "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ " + 123
|
||||
next
|
||||
e b = 8
|
||||
n
|
||||
e a
|
||||
c
|
||||
|
||||
@@ -3,12 +3,14 @@ Stopped at tests/debugger/do_eval.js:15
|
||||
(jerry-debugger) undefined
|
||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:23
|
||||
(jerry-debugger) 5
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_eval.js:17 (in f)
|
||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_eval.js:17 (in f)
|
||||
(jerry-debugger) undefined
|
||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:19 (in f)
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_eval.js:19 (in f() at line:17, col:1)
|
||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_eval.js:19 (in f() at line:17, col:1)
|
||||
(jerry-debugger) undefined
|
||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:20 (in f() at line:17, col:1)
|
||||
(jerry-debugger) 6
|
||||
(jerry-debugger) 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ 123
|
||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:20 (in f)
|
||||
(jerry-debugger) 8
|
||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:24
|
||||
(jerry-debugger) 11.3
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
@@ -20,4 +20,5 @@ function f(a)
|
||||
return a + b;
|
||||
}
|
||||
|
||||
f(3.3)
|
||||
a = f(3.3);
|
||||
null;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
b f
|
||||
n
|
||||
next
|
||||
n
|
||||
s
|
||||
src
|
||||
n
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_src.js:19
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_src.js:15 (in f)
|
||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_src.js:15 (in f)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_src.js:16 (in f)
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_src.js:16 (in f() at line:15, col:1)
|
||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_src.js:16 (in f() at line:15, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_src.js:20
|
||||
(jerry-debugger) Stopped at <unknown>:1
|
||||
(jerry-debugger) f = function f() {
|
||||
print('F2') }
|
||||
(jerry-debugger) Stopped at tests/debugger/do_src.js:21
|
||||
(jerry-debugger) Stopped at <unknown>:2 (in f)
|
||||
(jerry-debugger) Stopped at <unknown>:2 (in f() at line:1, col:5)
|
||||
(jerry-debugger) f = function f() {
|
||||
print('F2') }
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
|
||||
@@ -19,4 +19,3 @@ function f() {
|
||||
f();
|
||||
eval("f = function f() {\nprint('F2') }");
|
||||
f();
|
||||
f();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
break do_step.js:25
|
||||
step
|
||||
step
|
||||
backtrace
|
||||
b do_step.js:26
|
||||
next
|
||||
next
|
||||
bt
|
||||
next
|
||||
s
|
||||
n
|
||||
bt
|
||||
c
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_step.js:25
|
||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_step.js:25
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:15 (in f1)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:15 (in f1)
|
||||
Frame 1: tests/debugger/do_step.js:25
|
||||
(jerry-debugger) Breakpoint 2 at tests/debugger/do_step.js:26
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:17 (in f1)
|
||||
(jerry-debugger) Stopped at breakpoint:2 tests/debugger/do_step.js:26
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:26
|
||||
Stopped at tests/debugger/do_step.js:32
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:22 (in f1() at line:15, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:19 (in g() at line:17, col:3)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:19 (in g() at line:17, col:3)
|
||||
Frame 1: tests/debugger/do_step.js:22 (in f1() at line:15, col:1)
|
||||
Frame 2: tests/debugger/do_step.js:32
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:23 (in f1() at line:15, col:1)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:23 (in f1() at line:15, col:1)
|
||||
Frame 1: tests/debugger/do_step.js:32
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:33
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:28 (in f2() at line:26, col:1)
|
||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:29 (in f2() at line:26, col:1)
|
||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:29 (in f2() at line:26, col:1)
|
||||
Frame 1: tests/debugger/do_step.js:33
|
||||
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||
Connection closed.
|
||||
|
||||
@@ -14,12 +14,19 @@
|
||||
|
||||
function f1()
|
||||
{
|
||||
var i = 1;
|
||||
function g()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
var i = g();
|
||||
g();
|
||||
}
|
||||
|
||||
function f2()
|
||||
{
|
||||
var y = 2;
|
||||
f1();
|
||||
return 7;
|
||||
}
|
||||
|
||||
f1();
|
||||
|
||||
Reference in New Issue
Block a user