Make debugger port runtime configurable

Convert debug server port from a compile-time constant to a context
variable. This enables each engine instance (either running in the
same process or in different processes) to listen for connections
at different ports, i.e., multiple engines can be debugged at the
same time on the same machine.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2017-06-21 15:30:28 +02:00
committed by yichoi
parent cfa4fdd1ef
commit 18283d22c0
21 changed files with 59 additions and 47 deletions
+1 -10
View File
@@ -24,13 +24,6 @@
#include <fcntl.h>
#include <unistd.h>
/**
* Debugger socket communication port.
*/
#ifndef JERRY_DEBUGGER_PORT
#define JERRY_DEBUGGER_PORT 5001
#endif
/**
* Masking-key is available.
*/
@@ -314,10 +307,8 @@ jerry_debugger_accept_connection (void)
struct sockaddr_in addr;
socklen_t sin_size = sizeof (struct sockaddr_in);
JERRY_ASSERT (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_DEBUGGER);
addr.sin_family = AF_INET;
addr.sin_port = htons (JERRY_DEBUGGER_PORT);
addr.sin_port = htons (JERRY_CONTEXT (debugger_port));
addr.sin_addr.s_addr = INADDR_ANY;
if ((server_socket = socket (AF_INET, SOCK_STREAM, 0)) == -1)