Rework usages/naming of configuration macros [part 3] (#2927)

Reworked the JERRY_DEBUGGER macro to be a 0/1 switch.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2019-07-01 13:12:19 +02:00
committed by Dániel Bátyai
parent 1ea77cc490
commit eef1efa394
29 changed files with 175 additions and 160 deletions
+4 -4
View File
@@ -204,8 +204,8 @@ struct jerry_context_t *jerry_port_get_current_context (void);
* Makes the process sleep for a given time.
*
* Note:
* This port function is called by jerry-core when JERRY_DEBUGGER is
* defined. Otherwise this function is not used.
* This port function is called by jerry-core when JERRY_DEBUGGER is set to 1.
* Otherwise this function is not used.
*
* @param sleep_time milliseconds to sleep.
*/
@@ -351,7 +351,7 @@ jerry_port_get_current_context (void)
#include <unistd.h>
#endif /* HAVE_TIME_H */
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
void jerry_port_sleep (uint32_t sleep_time)
{
#ifdef HAVE_TIME_H
@@ -365,5 +365,5 @@ void jerry_port_sleep (uint32_t sleep_time)
#endif /* HAVE_TIME_H */
(void) sleep_time;
} /* jerry_port_sleep */
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
```
+1 -1
View File
@@ -256,7 +256,7 @@ endif()
# Enable debugger
if(FEATURE_DEBUGGER)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER=1)
endif()
# Memory management stress-test mode
+2 -2
View File
@@ -17,7 +17,7 @@
#include "jcontext.h"
#include "jerryscript.h"
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Minimum number of bytes transmitted or received.
@@ -247,4 +247,4 @@ jerry_debugger_transport_sleep (void)
jerry_port_sleep (JERRY_DEBUGGER_TRANSPORT_TIMEOUT);
} /* jerry_debugger_transport_sleep */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
+19 -19
View File
@@ -26,11 +26,11 @@
bool
jerry_debugger_is_connected (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
return JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED;
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
return false;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_is_connected */
/**
@@ -39,14 +39,14 @@ jerry_debugger_is_connected (void)
void
jerry_debugger_stop (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_stop */
/**
@@ -55,14 +55,14 @@ jerry_debugger_stop (void)
void
jerry_debugger_continue (void)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_continue */
/**
@@ -71,7 +71,7 @@ jerry_debugger_continue (void)
void
jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/disable stop at breakpoint */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
@@ -84,9 +84,9 @@ jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/d
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE);
}
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (enable_stop_at_breakpoint);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_stop_at_breakpoint */
/**
@@ -104,7 +104,7 @@ jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t
{
*return_value = jerry_create_undefined ();
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
@@ -176,12 +176,12 @@ jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t
}
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (callback_p);
JERRY_UNUSED (user_p);
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_wait_for_client_source */
/**
@@ -192,7 +192,7 @@ void
jerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
@@ -200,10 +200,10 @@ jerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_send_output */
/**
@@ -214,7 +214,7 @@ jerry_debugger_send_log (jerry_log_level_t level, /**< level of the diagnostics
const jerry_char_t *buffer, /**< buffer */
jerry_size_t str_size) /**< string size */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
@@ -222,9 +222,9 @@ jerry_debugger_send_log (jerry_log_level_t level, /**< level of the diagnostics
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
#else /* !ENABLED (JERRY_DEBUGGER) */
JERRY_UNUSED (level);
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
} /* jerry_debugger_send_log */
+2 -2
View File
@@ -658,9 +658,9 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
JERRY_ASSERT (bytecode_p->refs == 1);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
bytecode_p->status_flags = (uint16_t) (bytecode_p->status_flags | CBC_CODE_FLAGS_DEBUGGER_IGNORE);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
ecma_value_t *literal_start_p = (ecma_value_t *) (((uint8_t *) bytecode_p) + header_size);
+10 -10
View File
@@ -191,14 +191,14 @@ jerry_cleanup (void)
{
jerry_assert_api_available ();
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_type (JERRY_DEBUGGER_CLOSE_CONNECTION);
jerry_debugger_transport_close ();
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p);
this_p != NULL;
@@ -379,7 +379,7 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
size_t source_size, /**< script source size */
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
{
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
#if ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& resource_name_length > 0)
{
@@ -388,10 +388,10 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a
resource_name_p,
resource_name_length);
}
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
#else /* !(ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)) */
JERRY_UNUSED (resource_name_p);
JERRY_UNUSED (resource_name_length);
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
#endif /* ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER) */
#if ENABLED (JERRY_PARSER)
jerry_assert_api_available ();
@@ -449,7 +449,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
size_t source_size, /**< script source size */
uint32_t parse_opts) /**< jerry_parse_opts_t option bits */
{
#if defined JERRY_DEBUGGER && ENABLED (JERRY_PARSER)
#if ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE_NAME,
@@ -457,10 +457,10 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u
resource_name_p,
resource_name_length);
}
#else /* !(JERRY_DEBUGGER && ENABLED (JERRY_PARSER)) */
#else /* !(ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER)) */
JERRY_UNUSED (resource_name_p);
JERRY_UNUSED (resource_name_length);
#endif /* JERRY_DEBUGGER && ENABLED (JERRY_PARSER) */
#endif /* ENABLED (JERRY_DEBUGGER) && ENABLED (JERRY_PARSER) */
#if ENABLED (JERRY_PARSER)
jerry_assert_api_available ();
@@ -902,9 +902,9 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
#if ENABLED (JERRY_SNAPSHOT_EXEC)
|| feature == JERRY_FEATURE_SNAPSHOT_EXEC
#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
|| feature == JERRY_FEATURE_DEBUGGER
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_VM_EXEC_STOP)
|| feature == JERRY_FEATURE_VM_EXEC_STOP
#endif /* ENABLED (JERRY_VM_EXEC_STOP) */
+15
View File
@@ -159,6 +159,17 @@
# define JERRY_CPOINTER_32_BIT 0
#endif /* !defined (JERRY_CPOINTER_32_BIT) */
/**
* Enable/Disable the engine's JavaScript debugger interface
*
* Allowed values:
* 0: Disable the debugger parts.
* 1: Enable the debugger.
*/
#ifndef JERRY_DEBUGGER
# define JERRY_DEBUGGER 0
#endif /* !defined (JERRY_DEBUGGER) */
/**
* Enable/Disable built-in error messages for error objects.
*
@@ -605,6 +616,10 @@
|| ((JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1))
# error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
#endif
#if !defined (JERRY_DEBUGGER) \
|| ((JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1))
# error "Invalid value for 'JERRY_DEBUGGER' macro."
#endif
#if !defined (JERRY_ERROR_MESSAGES) \
|| ((JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1))
# error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
+2 -2
View File
@@ -24,7 +24,7 @@
#include "jerryscript-port.h"
#include "lit-char-helpers.h"
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Incoming message: next message of string data.
@@ -1541,4 +1541,4 @@ jerry_debugger_send_exception_string (void)
return result;
} /* jerry_debugger_send_exception_string */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
+2 -2
View File
@@ -19,7 +19,7 @@
#include "ecma-globals.h"
#include "jerryscript-debugger-transport.h"
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
@@ -486,6 +486,6 @@ bool jerry_debugger_send_parse_function (uint32_t line, uint32_t column);
void jerry_debugger_send_memstats (void);
bool jerry_debugger_send_exception_string (void);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* !DEBUGGER_H */
+2 -2
View File
@@ -1056,14 +1056,14 @@ ecma_gc_run (jmem_free_unused_memory_severity_t severity) /**< gc severity */
void
ecma_free_unused_memory (jmem_free_unused_memory_severity_t severity) /**< severity of the request */
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
while ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& JERRY_CONTEXT (debugger_byte_code_free_tail) != ECMA_NULL_POINTER)
{
/* Wait until all byte code is freed or the connection is aborted. */
jerry_debugger_receive (NULL);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (severity == JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW)
{
+4 -4
View File
@@ -81,12 +81,12 @@ typedef enum
ECMA_TYPE___MAX = ECMA_TYPE_ERROR /** highest value for ecma types */
} ecma_type_t;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Shift for scope chain index part in ecma_parse_opts
*/
#define ECMA_PARSE_CHAIN_INDEX_SHIFT 16
#endif
#endif /* ENABLED (JERRY_DEBUGGER) */
/**
* Option flags for script parsing.
@@ -712,9 +712,9 @@ typedef enum
/**
* Non closure flag for debugger.
*/
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
#define ECMA_OBJECT_FLAG_NON_CLOSURE 0x20
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
/**
* Value for increasing or decreasing the object reference counter.
+4 -4
View File
@@ -25,9 +25,9 @@
#include "re-compiler.h"
#include "ecma-builtins.h"
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
#include "debugger.h"
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
/** \addtogroup ecma ECMA
* @{
@@ -1548,7 +1548,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
}
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(bytecode_p->status_flags & CBC_CODE_FLAGS_DEBUGGER_IGNORE)
&& jerry_debugger_send_function_cp (JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP, bytecode_p))
@@ -1580,7 +1580,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
JERRY_CONTEXT (debugger_byte_code_free_head) = byte_code_free_cp;
return;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_MEM_STATS)
jmem_stats_free_byte_code_bytes (((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
@@ -823,9 +823,9 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
return ECMA_VALUE_ERROR;
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
return ret_value;
}
#if ENABLED (JERRY_ES2015_ARROW_FUNCTION)
+1 -1
View File
@@ -173,7 +173,7 @@ struct jerry_context_t *jerry_port_get_current_context (void);
*
* Note:
* This port function is called by jerry-core when JERRY_DEBUGGER is
* defined. Otherwise this function is not used.
* enabled (set to 1). Otherwise this function is not used.
*
* @param sleep_time milliseconds to sleep.
*/
+2 -2
View File
@@ -174,7 +174,7 @@ struct jerry_context_t
uint32_t vm_recursion_counter; /**< VM recursion counter */
#endif /* defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
uint8_t debugger_send_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for sending messages */
uint8_t debugger_receive_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for receiving messages */
jerry_debugger_transport_header_t *debugger_transport_header_p; /**< head of transport protocol chain */
@@ -189,7 +189,7 @@ struct jerry_context_t
uint8_t debugger_message_delay; /**< call receive message when reaches zero */
uint8_t debugger_max_send_size; /**< maximum amount of data that can be sent */
uint8_t debugger_max_receive_size; /**< maximum amount of data that can be received */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
ecma_value_t resource_name; /**< resource name (usually a file name) */
+4 -4
View File
@@ -903,10 +903,10 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
if (status_flags & PARSER_IS_FUNC_EXPRESSION)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (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 */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (!lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
{
@@ -922,7 +922,7 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,
@@ -934,7 +934,7 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
context_p->token.line = debugger_line;
context_p->token.column = debugger_column;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (context_p->token.literal_is_reserved
|| context_p->lit_object.type != LEXER_LITERAL_OBJECT_ANY)
+6 -6
View File
@@ -285,7 +285,7 @@ typedef struct parser_branch_node_t
parser_branch_t branch; /**< branch */
} parser_branch_node_t;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Extra information for each breakpoint.
*/
@@ -300,7 +300,7 @@ typedef struct
#define PARSER_MAX_BREAKPOINT_INFO_COUNT \
(JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
/**
* Those members of a context which needs
@@ -388,11 +388,11 @@ typedef struct
uint32_t total_byte_code_size; /**< total byte code size */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
uint16_t breakpoint_info_count; /**< current breakpoint index */
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */
@@ -605,11 +605,11 @@ void parser_raise_error (parser_context_t *context_p, parser_error_t error);
/* Debug functions. */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_header_type_t type, uint32_t value);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
+16 -16
View File
@@ -344,9 +344,9 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
#if defined (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO)
#if ENABLED (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO)
parser_line_counter_t ident_line_counter = context_p->token.line;
#endif /* JERRY_DEBUGGER || ENABLED (JERRY_LINE_INFO) */
#endif /* ENABLED (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO) */
context_p->lit_object.literal_p->status_flags |= LEXER_FLAG_VAR;
@@ -362,7 +362,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
if (context_p->token.type == LEXER_ASSIGN)
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& ident_line_counter != context_p->last_breakpoint_line)
{
@@ -373,7 +373,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
context_p->last_breakpoint_line = ident_line_counter;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
if (ident_line_counter != context_p->last_line_info_line)
@@ -407,10 +407,10 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_FUNCTION);
#ifdef JERRY_DEBUGGER
#if ENABLED (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 */
#endif /* ENABLED (JERRY_DEBUGGER) */
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
@@ -439,7 +439,7 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
status_flags |= PARSER_HAS_NON_STRICT_ARG;
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_FUNCTION_NAME,
@@ -451,7 +451,7 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
context_p->token.line = debugger_line;
context_p->token.column = debugger_column;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (name_p->status_flags & LEXER_FLAG_INITIALIZED)
{
@@ -2181,14 +2181,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
#if ENABLED (JERRY_DEBUGGER)
/* Set lexical enviroment for the debugger. */
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 */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
if (JERRY_CONTEXT (resource_name) != ECMA_VALUE_UNDEFINED)
@@ -2229,7 +2229,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
/* The string is part of an expression statement. */
context_p->status_flags = status_flags;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
JERRY_ASSERT (context_p->last_breakpoint_line == 0);
@@ -2241,7 +2241,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
context_p->last_breakpoint_line = context_p->token.line;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
parser_emit_line_info (context_p, context_p->token.line, false);
#endif /* ENABLED (JERRY_LINE_INFO) */
@@ -2293,7 +2293,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
JERRY_ASSERT (context_p->stack_depth == context_p->context_stack_depth);
#endif /* !JERRY_NDEBUG */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
&& context_p->token.line != context_p->last_breakpoint_line
&& context_p->token.type != LEXER_SEMICOLON
@@ -2311,7 +2311,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
context_p->last_breakpoint_line = context_p->token.line;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
if (context_p->token.line != context_p->last_line_info_line
@@ -2573,14 +2573,14 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
case LEXER_KEYW_DEBUGGER:
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/* This breakpoint location is not reported to the
* debugger, so it is impossible to disable it. */
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
parser_emit_cbc (context_p, CBC_BREAKPOINT_ENABLED);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
lexer_next_token (context_p);
break;
}
+26 -26
View File
@@ -1374,7 +1374,7 @@ parse_print_final_cbc (ecma_compiled_code_t *compiled_code_p, /**< compiled code
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
/**
* Send current breakpoint list.
@@ -1414,7 +1414,7 @@ parser_append_breakpoint_info (parser_context_t *context_p, /**< context */
context_p->breakpoint_info_count = (uint16_t) (context_p->breakpoint_info_count + 1);
} /* parser_append_breakpoint_info */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
/**
* Forward iterator: move to the next byte code
@@ -1488,7 +1488,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
JERRY_ASSERT (context_p->literal_count <= PARSER_MAXIMUM_NUMBER_OF_LITERALS);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(context_p->status_flags & PARSER_DEBUGGER_BREAKPOINT_APPENDED))
{
@@ -1507,7 +1507,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);
JERRY_ASSERT (context_p->breakpoint_info_count == 0);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
parser_copy_identifiers (context_p);
@@ -1901,13 +1901,13 @@ parser_post_processing (parser_context_t *context_p) /**< context */
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
flags = cbc_flags[opcode];
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (opcode == CBC_BREAKPOINT_DISABLED)
{
uint32_t bp_offset = (uint32_t) (((uint8_t *) dst_p) - ((uint8_t *) compiled_code_p) - 1);
parser_append_breakpoint_info (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST, bp_offset);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (opcode == CBC_EXT_OPCODE)
{
@@ -2023,14 +2023,14 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& context_p->breakpoint_info_count > 0)
{
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST);
JERRY_ASSERT (context_p->breakpoint_info_count == 0);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (!(context_p->status_flags & PARSER_NO_END_LABEL))
{
@@ -2148,12 +2148,12 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
#endif /* ENABLED (JERRY_LINE_INFO) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_function_cp (JERRY_DEBUGGER_BYTE_CODE_CP, compiled_code_p);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
return compiled_code_p;
} /* parser_post_processing */
@@ -2378,14 +2378,14 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
else
{
context.status_flags = PARSER_IS_FUNCTION;
#ifdef JERRY_DEBUGGER
#if ENABLED (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.status_flags |= PARSER_LEXICAL_ENV_NEEDED | PARSER_NO_REG_STORE;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
context.source_p = arg_list_p;
context.source_end_p = arg_list_p + arg_list_size;
}
@@ -2437,9 +2437,9 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
context.breakpoint_info_count = 0;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
PARSER_TRY (context.try_buffer)
{
@@ -2547,14 +2547,14 @@ parser_save_context (parser_context_t *context_p, /**< context */
{
JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& context_p->breakpoint_info_count > 0)
{
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);
context_p->breakpoint_info_count = 0;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
/* Save private part of the context. */
@@ -2658,7 +2658,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& jerry_debugger_send_parse_function (context_p->token.line, context_p->token.column))
{
@@ -2666,7 +2666,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
* 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 */
#endif /* ENABLED (JERRY_DEBUGGER) */
lexer_next_token (context_p);
@@ -2763,7 +2763,7 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& jerry_debugger_send_parse_function (context_p->token.line, context_p->token.column))
{
@@ -2771,7 +2771,7 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
* 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 */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (status_flags & PARSER_ARROW_PARSE_ARGS)
{
@@ -2912,7 +2912,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
#if ENABLED (JERRY_PARSER)
parser_error_location_t parser_error;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_SOURCE_CODE,
@@ -2920,7 +2920,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
source_p,
source_size);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
*bytecode_data_p = parser_parse_source (arg_list_p,
arg_list_size,
@@ -2937,12 +2937,12 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
ecma_module_cleanup ();
}
#endif
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_type (JERRY_DEBUGGER_PARSE_ERROR);
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
if (parser_error.error == PARSER_ERR_OUT_OF_MEMORY)
{
@@ -2993,7 +2993,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
}
#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if ((JERRY_CONTEXT (debugger_flags) & (JERRY_DEBUGGER_CONNECTED | JERRY_DEBUGGER_PARSER_WAIT))
== (JERRY_DEBUGGER_CONNECTED | JERRY_DEBUGGER_PARSER_WAIT))
{
@@ -3012,7 +3012,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */
jerry_debugger_transport_sleep ();
}
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
return ECMA_VALUE_TRUE;
#else /* !ENABLED (JERRY_PARSER) */
+22 -22
View File
@@ -296,7 +296,7 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);
lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
uint32_t chain_index = parse_opts >> ECMA_PARSE_CHAIN_INDEX_SHIFT;
while (chain_index != 0)
@@ -314,7 +314,7 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
chain_index--;
}
}
#endif
#endif /* ENABLED (JERRY_DEBUGGER) */
}
else
{
@@ -503,9 +503,9 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
}
else
@@ -591,9 +591,9 @@ opfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
}
else
@@ -667,9 +667,9 @@ opfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (completion_value)))
{
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_CONTEXT (debugger_exception_byte_code_p) = frame_ctx_p->byte_code_p;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
frame_ctx_p->byte_code_p = (uint8_t *) vm_error_byte_code_p;
}
else
@@ -1975,9 +1975,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
case VM_OC_ERROR:
{
JERRY_ASSERT (frame_ctx_p->byte_code_p[1] == CBC_EXT_ERROR);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
frame_ctx_p->byte_code_p = JERRY_CONTEXT (debugger_exception_byte_code_p);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
result = ECMA_VALUE_ERROR;
goto error;
@@ -3063,9 +3063,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
stack_top_p -= PARSER_TRY_CONTEXT_STACK_ALLOCATION;
result = ECMA_VALUE_ERROR;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
goto error;
}
case VM_CONTEXT_FINALLY_RETURN:
@@ -3109,7 +3109,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
JERRY_ASSERT (frame_ctx_p->registers_p + register_end + frame_ctx_p->context_depth == stack_top_p);
continue;
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
case VM_OC_BREAKPOINT_ENABLED:
{
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_IGNORE)
@@ -3183,7 +3183,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
continue;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
case VM_OC_RESOURCE_NAME:
{
@@ -3358,7 +3358,7 @@ error:
}
stack_top_p = frame_ctx_p->registers_p + register_end + frame_ctx_p->context_depth;
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
const uint32_t dont_stop = (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION
| JERRY_DEBUGGER_VM_IGNORE
| JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
@@ -3388,7 +3388,7 @@ error:
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
}
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
}
JERRY_ASSERT (frame_ctx_p->registers_p + register_end + frame_ctx_p->context_depth == stack_top_p);
@@ -3426,9 +3426,9 @@ error:
{
JERRY_ASSERT (frame_ctx_p->registers_p + register_end + frame_ctx_p->context_depth == stack_top_p);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
byte_code_p = frame_ctx_p->byte_code_p;
@@ -3446,9 +3446,9 @@ error:
}
ecma_object_t *catch_env_p = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
catch_env_p->type_flags_refs |= (uint16_t) ECMA_OBJECT_FLAG_NON_CLOSURE;
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
ecma_string_t *catch_name_p = ecma_get_string_from_value (literal_start_p[literal_index]);
ecma_op_create_mutable_binding (catch_env_p, catch_name_p, false);
@@ -3596,14 +3596,14 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
ecma_fast_free_value (frame_ctx_p->registers_p[i]);
}
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
if (JERRY_CONTEXT (debugger_stop_context) == JERRY_CONTEXT (vm_top_context_p))
{
/* The engine will stop when the next breakpoint is reached. */
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if defined (JERRY_VM_RECURSION_LIMIT) && (JERRY_VM_RECURSION_LIMIT != 0)
JERRY_CONTEXT (vm_recursion_counter)++;
+4 -4
View File
@@ -232,10 +232,10 @@ typedef enum
VM_OC_PUSH_CONSTRUCTOR_THIS, /**< push 'this' inside a class constructor */
VM_OC_CONSTRUCTOR_RET, /**< explicit return from a class constructor */
#endif /* ENABLED (JERRY_ES2015_CLASS) */
#ifdef JERRY_DEBUGGER
#if ENABLED (JERRY_DEBUGGER)
VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
#endif /* JERRY_DEBUGGER */
#endif /* ENABLED (JERRY_DEBUGGER) */
#if ENABLED (JERRY_LINE_INFO)
VM_OC_RESOURCE_NAME, /**< resource name of the current function */
VM_OC_LINE, /**< line number of the next statement */
@@ -251,10 +251,10 @@ typedef enum
#if !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER)
VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */
#endif /* !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */
#ifndef JERRY_DEBUGGER
#if !ENABLED (JERRY_DEBUGGER)
VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
#endif /* !JERRY_DEBUGGER */
#endif /* !ENABLED (JERRY_DEBUGGER) */
#if !ENABLED (JERRY_LINE_INFO)
VM_OC_RESOURCE_NAME = VM_OC_NONE, /**< resource name of the current function is unused */
VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */
+3 -3
View File
@@ -23,7 +23,7 @@ void
jerryx_debugger_after_connect (bool success) /**< tells whether the connection
* has been successfully established */
{
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
if (success)
{
jerry_debugger_transport_start ();
@@ -32,7 +32,7 @@ jerryx_debugger_after_connect (bool success) /**< tells whether the connection
{
jerry_debugger_transport_close ();
}
#else /* !JERRY_DEBUGGER */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */
JERRYX_UNUSED (success);
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
} /* jerryx_debugger_after_connect */
+3 -3
View File
@@ -16,7 +16,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* A simplified transmission layer. */
@@ -162,7 +162,7 @@ jerryx_debugger_rp_create (void)
return true;
} /* jerryx_debugger_rp_create */
#else /* !JERRY_DEBUGGER */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */
/**
* Dummy function when debugger is disabled.
@@ -175,4 +175,4 @@ jerryx_debugger_rp_create (void)
return false;
} /* jerryx_debugger_rp_create */
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
+3 -3
View File
@@ -17,7 +17,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
#if defined JERRY_DEBUGGER && !defined WIN32
#if (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined WIN32
#include <errno.h>
#include <fcntl.h>
@@ -393,7 +393,7 @@ jerryx_debugger_serial_create (const char *config) /**< specify the configuratio
return true;
} /* jerryx_debugger_serial_create */
#else /* !JERRY_DEBUGGER || WIN32 */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) || WIN32 */
/**
* Dummy function when debugger is disabled.
*
@@ -406,4 +406,4 @@ jerryx_debugger_serial_create (const char *config)
return false;
} /* jerryx_debugger_serial_create */
#endif /* JERRY_DEBUGGER */
#endif /* (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined WIN32 */
+2 -2
View File
@@ -43,7 +43,7 @@
#include "debugger-sha1.h"
#include "jext-common.h"
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/**
* SHA-1 context structure.
@@ -366,4 +366,4 @@ jerryx_debugger_compute_sha1 (const uint8_t *source1_p, /**< first part of the i
jerryx_sha1_finish (&sha1_context, destination_p);
} /* jerryx_debugger_compute_sha1 */
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
+2 -2
View File
@@ -18,7 +18,7 @@
#include "jerryscript-debugger-transport.h"
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
@@ -26,6 +26,6 @@ void jerryx_debugger_compute_sha1 (const uint8_t *input1, size_t input1_len,
const uint8_t *input2, size_t input2_len,
uint8_t output[20]);
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
#endif /* !DEBUGGER_SHA1_H */
+3 -3
View File
@@ -17,7 +17,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
#include <errno.h>
@@ -371,7 +371,7 @@ jerryx_debugger_tcp_create (uint16_t port) /**< listening port */
return true;
} /* jerryx_debugger_tcp_create */
#else /* !JERRY_DEBUGGER */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */
/**
* Dummy function when debugger is disabled.
@@ -385,4 +385,4 @@ jerryx_debugger_tcp_create (uint16_t port)
return false;
} /* jerryx_debugger_tcp_create */
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
+3 -3
View File
@@ -17,7 +17,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
@@ -450,7 +450,7 @@ jerryx_debugger_ws_create (void)
return true;
} /* jerryx_debugger_ws_create */
#else /* !JERRY_DEBUGGER */
#else /* !(defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) */
/**
* Dummy function when debugger is disabled.
@@ -463,4 +463,4 @@ jerryx_debugger_ws_create (void)
return false;
} /* jerryx_debugger_ws_create */
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
+6 -6
View File
@@ -85,7 +85,7 @@ jerry_port_log (jerry_log_level_t level, /**< message log level */
{
va_list args;
va_start (args, format);
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
int length = vsnprintf (NULL, 0, format, args);
va_end (args);
va_start (args, format);
@@ -97,18 +97,18 @@ jerry_port_log (jerry_log_level_t level, /**< message log level */
jerry_debugger_send_log (level, (jerry_char_t *) buffer, (jerry_size_t) length);
#else /* If jerry-debugger isn't defined, libc is turned on */
vfprintf (stderr, format, args);
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
va_end (args);
}
} /* jerry_port_log */
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
#define DEBUG_BUFFER_SIZE (256)
static char debug_buffer[DEBUG_BUFFER_SIZE];
static int debug_buffer_index = 0;
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
/**
* Default implementation of jerry_port_print_char. Uses 'putchar' to
@@ -119,7 +119,7 @@ jerry_port_print_char (char c) /**< the character to print */
{
putchar (c);
#ifdef JERRY_DEBUGGER
#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
debug_buffer[debug_buffer_index++] = c;
if ((debug_buffer_index == DEBUG_BUFFER_SIZE) || (c == '\n'))
@@ -127,7 +127,7 @@ jerry_port_print_char (char c) /**< the character to print */
jerry_debugger_send_output ((jerry_char_t *) debug_buffer, (jerry_size_t) debug_buffer_index);
debug_buffer_index = 0;
}
#endif /* JERRY_DEBUGGER */
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
} /* jerry_port_print_char */
/**