@ -146,9 +146,9 @@ static const bool use_inspector = false;
# endif
# endif
static bool use_debug_agent = false ;
static bool use_debug_agent = false ;
static bool debug_wait_connect = false ;
static bool debug_wait_connect = false ;
static std : : string debug_host ; // NOLINT(runtime/string)
static std : : string * debug_host ; // coverity[leaked_storage]
static int debug_port = 5858 ;
static int debug_port = 5858 ;
static std : : string inspector_host ; // NOLINT(runtime/string)
static std : : string * inspector_host ; // coverity[leaked_storage]
static int inspector_port = 9229 ;
static int inspector_port = 9229 ;
static const int v8_default_thread_pool_size = 4 ;
static const int v8_default_thread_pool_size = 4 ;
static int v8_thread_pool_size = v8_default_thread_pool_size ;
static int v8_thread_pool_size = v8_default_thread_pool_size ;
@ -3468,7 +3468,7 @@ static bool ParseDebugOpt(const char* arg) {
return true ;
return true ;
}
}
std : : string * const the_host = use_inspector ? & inspector_host : & debug_host ;
std : : string * * const the_host = use_inspector ? & inspector_host : & debug_host ;
int * const the_port = use_inspector ? & inspector_port : & debug_port ;
int * const the_port = use_inspector ? & inspector_port : & debug_port ;
// FIXME(bnoordhuis) Move IPv6 address parsing logic to lib/net.js.
// FIXME(bnoordhuis) Move IPv6 address parsing logic to lib/net.js.
@ -3476,7 +3476,7 @@ static bool ParseDebugOpt(const char* arg) {
// in net.Server#listen() and net.Socket#connect().
// in net.Server#listen() and net.Socket#connect().
const size_t port_len = strlen ( port ) ;
const size_t port_len = strlen ( port ) ;
if ( port [ 0 ] = = ' [ ' & & port [ port_len - 1 ] = = ' ] ' ) {
if ( port [ 0 ] = = ' [ ' & & port [ port_len - 1 ] = = ' ] ' ) {
the_host - > assign ( port + 1 , port_len - 2 ) ;
* the_host = new std : : string ( port + 1 , port_len - 2 ) ;
return true ;
return true ;
}
}
@ -3486,13 +3486,13 @@ static bool ParseDebugOpt(const char* arg) {
// if it's not all decimal digits, it's a host name.
// if it's not all decimal digits, it's a host name.
for ( size_t n = 0 ; port [ n ] ! = ' \0 ' ; n + = 1 ) {
for ( size_t n = 0 ; port [ n ] ! = ' \0 ' ; n + = 1 ) {
if ( port [ n ] < ' 0 ' | | port [ n ] > ' 9 ' ) {
if ( port [ n ] < ' 0 ' | | port [ n ] > ' 9 ' ) {
* the_host = port ;
* the_host = new std : : string ( port ) ;
return true ;
return true ;
}
}
}
}
} else {
} else {
const bool skip = ( colon > port & & port [ 0 ] = = ' [ ' & & colon [ - 1 ] = = ' ] ' ) ;
const bool skip = ( colon > port & & port [ 0 ] = = ' [ ' & & colon [ - 1 ] = = ' ] ' ) ;
the_host - > assign ( port + skip , colon - skip ) ;
* the_host = new std : : string ( port + skip , colon - skip ) ;
}
}
char * endptr ;
char * endptr ;
@ -3769,11 +3769,11 @@ static void StartDebug(Environment* env, bool wait) {
} else {
} else {
env - > debugger_agent ( ) - > set_dispatch_handler (
env - > debugger_agent ( ) - > set_dispatch_handler (
DispatchMessagesDebugAgentCallback ) ;
DispatchMessagesDebugAgentCallback ) ;
const char * host = debug_host ? debug_host - > c_str ( ) : " 127.0.0.1 " ;
debugger_running =
debugger_running =
env - > debugger_agent ( ) - > Start ( debug_ host, debug_port , wait ) ;
env - > debugger_agent ( ) - > Start ( host , debug_port , wait ) ;
if ( debugger_running = = false ) {
if ( debugger_running = = false ) {
fprintf ( stderr , " Starting debugger on %s:%d failed \n " ,
fprintf ( stderr , " Starting debugger on %s:%d failed \n " , host , debug_port ) ;
debug_host . c_str ( ) , debug_port ) ;
fflush ( stderr ) ;
fflush ( stderr ) ;
return ;
return ;
}
}