diff --git a/jerry-core/CMakeLists.txt b/jerry-core/CMakeLists.txt index eb1238b244..6fc9ced7c5 100644 --- a/jerry-core/CMakeLists.txt +++ b/jerry-core/CMakeLists.txt @@ -19,6 +19,7 @@ project (${JERRY_CORE_NAME} C) # Optional features set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?") set(FEATURE_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?") +set(FEATURE_DEBUGGER_PORT "5001" CACHE STRING "Set debugger port number (default: 5001)") set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?") set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?") set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?") @@ -40,6 +41,7 @@ endif() # Status messages message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT}) message(STATUS "FEATURE_DEBUGGER " ${FEATURE_DEBUGGER}) +message(STATUS "FEATURE_DEBUGGER_PORT " ${FEATURE_DEBUGGER_PORT}) message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES}) message(STATUS "FEATURE_JS_PARSER " ${FEATURE_JS_PARSER}) message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS}) @@ -175,6 +177,9 @@ if(FEATURE_DEBUGGER) set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER) endif() +# Debugger port +set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER_PORT=${FEATURE_DEBUGGER_PORT}) + # Memory management stress-test mode if(FEATURE_MEM_STRESS_TEST) set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_GC_BEFORE_EACH_ALLOC) diff --git a/jerry-core/debugger/jerry-debugger-ws.c b/jerry-core/debugger/jerry-debugger-ws.c index ab7880cf52..32e801127b 100644 --- a/jerry-core/debugger/jerry-debugger-ws.c +++ b/jerry-core/debugger/jerry-debugger-ws.c @@ -27,7 +27,9 @@ /** * Debugger socket communication port. */ +#ifndef JERRY_DEBUGGER_PORT #define JERRY_DEBUGGER_PORT 5001 +#endif /** * Masking-key is available. diff --git a/tools/build.py b/tools/build.py index 5692a5a6f1..8154425e32 100755 --- a/tools/build.py +++ b/tools/build.py @@ -57,6 +57,7 @@ def devhelp(help): parser.add_argument('--jerry-cmdline', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build jerry command line tool (%(choices)s; default: %(default)s)') parser.add_argument('--jerry-cmdline-minimal', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='build minimal version of the jerry command line tool (%(choices)s; default: %(default)s)') parser.add_argument('--jerry-debugger', metavar='X', choices=['ON', 'OFF'], default='OFF', type=str.upper, help='enable the jerry debugger (%(choices)s; default: %(default)s)') + parser.add_argument('--jerry-debugger-port', metavar='N', action='store', type=int, default=5001, help='add custom port number (default: %(default)s)') parser.add_argument('--jerry-libc', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libc (%(choices)s; default: %(default)s)') parser.add_argument('--jerry-libm', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='build and use jerry-libm (%(choices)s; default: %(default)s)') parser.add_argument('--js-parser', metavar='X', choices=['ON', 'OFF'], default='ON', type=str.upper, help='enable js-parser (%(choices)s; default: %(default)s)') @@ -119,6 +120,7 @@ def generate_build_options(arguments): build_options.append('-DFEATURE_PROFILE=%s' % PROFILE) build_options.append('-DFEATURE_DEBUGGER=%s' % arguments.jerry_debugger) + build_options.append('-DFEATURE_DEBUGGER_PORT=%d' % arguments.jerry_debugger_port) build_options.append('-DFEATURE_SNAPSHOT_EXEC=%s' % arguments.snapshot_exec) build_options.append('-DFEATURE_SNAPSHOT_SAVE=%s' % arguments.snapshot_save) build_options.append('-DFEATURE_SYSTEM_ALLOCATOR=%s' % arguments.system_allocator)