OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/public/chrome_main.h" | 7 #include "native_client/src/public/chrome_main.h" |
8 | 8 |
9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
10 #include "native_client/src/include/portability_io.h" | 10 #include "native_client/src/include/portability_io.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 args->imc_bootstrap_handle = NACL_INVALID_HANDLE; | 69 args->imc_bootstrap_handle = NACL_INVALID_HANDLE; |
70 args->irt_fd = -1; | 70 args->irt_fd = -1; |
71 args->enable_exception_handling = 0; | 71 args->enable_exception_handling = 0; |
72 args->enable_debug_stub = 0; | 72 args->enable_debug_stub = 0; |
73 args->enable_dyncode_syscalls = 1; | 73 args->enable_dyncode_syscalls = 1; |
74 args->pnacl_mode = 0; | 74 args->pnacl_mode = 0; |
75 args->initial_nexe_max_code_bytes = 0; /* No limit */ | 75 args->initial_nexe_max_code_bytes = 0; /* No limit */ |
76 #if NACL_LINUX || NACL_OSX | 76 #if NACL_LINUX || NACL_OSX |
77 args->debug_stub_server_bound_socket_fd = NACL_INVALID_SOCKET; | 77 args->debug_stub_server_bound_socket_fd = NACL_INVALID_SOCKET; |
78 #endif | 78 #endif |
| 79 args->debug_stub_server_port_selected_handler_func = NULL; |
79 args->create_memory_object_func = NULL; | 80 args->create_memory_object_func = NULL; |
80 args->validation_cache = NULL; | 81 args->validation_cache = NULL; |
81 #if NACL_WINDOWS | 82 #if NACL_WINDOWS |
82 args->broker_duplicate_handle_func = NULL; | 83 args->broker_duplicate_handle_func = NULL; |
83 args->attach_debug_exception_handler_func = NULL; | 84 args->attach_debug_exception_handler_func = NULL; |
84 #endif | 85 #endif |
85 #if NACL_LINUX || NACL_OSX | 86 #if NACL_LINUX || NACL_OSX |
86 args->number_of_cores = -1; /* unknown */ | 87 args->number_of_cores = -1; /* unknown */ |
87 #endif | 88 #endif |
88 #if NACL_LINUX | 89 #if NACL_LINUX |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 332 |
332 if (args->enable_debug_stub) { | 333 if (args->enable_debug_stub) { |
333 #if NACL_LINUX || NACL_OSX | 334 #if NACL_LINUX || NACL_OSX |
334 if (args->debug_stub_server_bound_socket_fd != NACL_INVALID_SOCKET) { | 335 if (args->debug_stub_server_bound_socket_fd != NACL_INVALID_SOCKET) { |
335 NaClDebugSetBoundSocket(args->debug_stub_server_bound_socket_fd); | 336 NaClDebugSetBoundSocket(args->debug_stub_server_bound_socket_fd); |
336 } | 337 } |
337 #endif | 338 #endif |
338 if (!NaClDebugInit(nap)) { | 339 if (!NaClDebugInit(nap)) { |
339 goto done; | 340 goto done; |
340 } | 341 } |
| 342 if (NULL != args->debug_stub_server_port_selected_handler_func) { |
| 343 args->debug_stub_server_port_selected_handler_func(nap->debug_stub_port); |
| 344 } |
341 } | 345 } |
342 | 346 |
343 free(args); | 347 free(args); |
344 args = NULL; | 348 args = NULL; |
345 | 349 |
346 if (NACL_FI_ERROR_COND( | 350 if (NACL_FI_ERROR_COND( |
347 "CreateMainThread", | 351 "CreateMainThread", |
348 !NaClCreateMainThread(nap, ac, av, | 352 !NaClCreateMainThread(nap, ac, av, |
349 NaClEnvCleanserEnvironment(&env_cleanser)))) { | 353 NaClEnvCleanserEnvironment(&env_cleanser)))) { |
350 NaClLog(LOG_FATAL, "creating main thread failed\n"); | 354 NaClLog(LOG_FATAL, "creating main thread failed\n"); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 * Instead, we wait for the hard-shutdown on the command channel. | 392 * Instead, we wait for the hard-shutdown on the command channel. |
389 */ | 393 */ |
390 if (LOAD_OK != errcode) { | 394 if (LOAD_OK != errcode) { |
391 NaClBlockIfCommandChannelExists(nap); | 395 NaClBlockIfCommandChannelExists(nap); |
392 } | 396 } |
393 | 397 |
394 NaClAllModulesFini(); | 398 NaClAllModulesFini(); |
395 | 399 |
396 NaClExit(ret_code); | 400 NaClExit(ret_code); |
397 } | 401 } |
OLD | NEW |