Send print output to debugger client from the port implementation (#2515)

... not from the print handler extension. The sending of logs is
already in the port implementation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2018-09-17 18:17:16 +02:00
committed by GitHub
parent 3031a11f86
commit b97f5ffca0
2 changed files with 18 additions and 24 deletions
+18
View File
@@ -17,6 +17,14 @@
#include "jerryscript-ext/handler.h"
#ifdef JERRY_DEBUGGER
#define DEBUG_BUFFER_SIZE (256)
static char debug_buffer[DEBUG_BUFFER_SIZE];
static int debug_buffer_index = 0;
#endif /* JERRY_DEBUGGER */
/**
* Default implementation of jerryx_port_handler_print_char. Uses 'printf' to
* print a single character to standard output.
@@ -25,4 +33,14 @@ void
jerryx_port_handler_print_char (char c) /**< the character to print */
{
printf ("%c", c);
#ifdef JERRY_DEBUGGER
debug_buffer[debug_buffer_index++] = c;
if ((debug_buffer_index == DEBUG_BUFFER_SIZE) || (c == '\n'))
{
jerry_debugger_send_output ((jerry_char_t *) debug_buffer, (jerry_size_t) debug_buffer_index);
debug_buffer_index = 0;
}
#endif /* JERRY_DEBUGGER */
} /* jerryx_port_handler_print_char */