Skip to content

Commit cc0f696

Browse files
Levente Orbanzherczeg
authored andcommitted
Add debugger connection port setting to build script (#1599)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban [email protected]
1 parent 9043ec6 commit cc0f696

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

jerry-core/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ project (${JERRY_CORE_NAME} C)
1919
# Optional features
2020
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
2121
set(FEATURE_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
22+
set(FEATURE_DEBUGGER_PORT "5001" CACHE STRING "Set debugger port number (default: 5001)")
2223
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
2324
set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?")
2425
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
@@ -40,6 +41,7 @@ endif()
4041
# Status messages
4142
message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT})
4243
message(STATUS "FEATURE_DEBUGGER " ${FEATURE_DEBUGGER})
44+
message(STATUS "FEATURE_DEBUGGER_PORT " ${FEATURE_DEBUGGER_PORT})
4345
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
4446
message(STATUS "FEATURE_JS_PARSER " ${FEATURE_JS_PARSER})
4547
message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS})
@@ -175,6 +177,9 @@ if(FEATURE_DEBUGGER)
175177
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER)
176178
endif()
177179

180+
# Debugger port
181+
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_DEBUGGER_PORT=${FEATURE_DEBUGGER_PORT})
182+
178183
# Memory management stress-test mode
179184
if(FEATURE_MEM_STRESS_TEST)
180185
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_GC_BEFORE_EACH_ALLOC)

jerry-core/debugger/jerry-debugger-ws.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
/**
2828
* Debugger socket communication port.
2929
*/
30+
#ifndef JERRY_DEBUGGER_PORT
3031
#define JERRY_DEBUGGER_PORT 5001
32+
#endif
3133

3234
/**
3335
* Masking-key is available.

tools/build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def devhelp(help):
5757
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)')
5858
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)')
5959
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)')
60+
parser.add_argument('--jerry-debugger-port', metavar='N', action='store', type=int, default=5001, help='add custom port number (default: %(default)s)')
6061
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)')
6162
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)')
6263
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):
119120
build_options.append('-DFEATURE_PROFILE=%s' % PROFILE)
120121

121122
build_options.append('-DFEATURE_DEBUGGER=%s' % arguments.jerry_debugger)
123+
build_options.append('-DFEATURE_DEBUGGER_PORT=%d' % arguments.jerry_debugger_port)
122124
build_options.append('-DFEATURE_SNAPSHOT_EXEC=%s' % arguments.snapshot_exec)
123125
build_options.append('-DFEATURE_SNAPSHOT_SAVE=%s' % arguments.snapshot_save)
124126
build_options.append('-DFEATURE_SYSTEM_ALLOCATOR=%s' % arguments.system_allocator)

0 commit comments

Comments
 (0)