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:
Zoltan Herczeg
2017-03-13 11:36:34 +01:00
committed by GitHub
parent 57ea06782b
commit 679500b327
30 changed files with 409 additions and 226 deletions
+24 -13
View File
@@ -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 */