@@ -203,23 +203,16 @@ void PerProcessOptions::CheckProcessTimeoutOptions(
203203 // make the timeout fire while the debugger is in control, so the two cannot
204204 // be combined. Runtime activation of the inspector is rejected separately.
205205 const DebugOptions& debug_options = per_isolate->per_env ->debug_options ();
206- const char * debug_option = nullptr ;
207- if (debug_options.break_node_first_line ) {
208- debug_option = " --inspect-brk-node" ;
209- } else if (debug_options.break_first_line ) {
210- debug_option = " --inspect-brk" ;
211- } else if (debug_options.inspect_wait ) {
212- debug_option = " --inspect-wait" ;
213- } else if (debug_options.inspector_enabled ) {
214- debug_option = " --inspect" ;
215- } else if (debug_options.host_port .host () != " 127.0.0.1" ||
216- debug_options.host_port .port () !=
217- DebugOptions::kDefaultInspectorPort ) {
218- // We can't catch the case where the value passed is the default value,
219- // then the option just becomes a noop which is fine.
220- debug_option = " --inspect-port" ;
221- } else if (debug_options.inspect_publish_uid_string != " stderr,http" ) {
222- debug_option = " --inspect-publish-uid" ;
206+ const char * debug_option = debug_options.inspector_option_name ();
207+ if (debug_option == nullptr ) {
208+ if (debug_options.host_port .host () != " 127.0.0.1" ||
209+ debug_options.host_port .port () != DebugOptions::kDefaultInspectorPort ) {
210+ // We can't catch the case where the value passed is the default value,
211+ // then the option just becomes a noop which is fine.
212+ debug_option = " --inspect-port" ;
213+ } else if (debug_options.inspect_publish_uid_string != " stderr,http" ) {
214+ debug_option = " --inspect-publish-uid" ;
215+ }
223216 }
224217 if (debug_option != nullptr ) {
225218 errors->push_back (std::string (" either --process-timeout or " ) +
@@ -297,6 +290,16 @@ void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors,
297290 HandleMaxOldSpaceSizePercentage (errors, &max_old_space_size_percentage);
298291 }
299292
293+ if (build_snapshot) {
294+ // V8 does not allow a debugger to be attached during snapshot building.
295+ const char * debug_option = per_env->debug_options ().inspector_option_name ();
296+ if (debug_option != nullptr ) {
297+ errors->push_back (
298+ std::string (" --build-snapshot cannot be used together with " ) +
299+ debug_option);
300+ }
301+ }
302+
300303 per_env->CheckOptions (errors, argv);
301304}
302305
0 commit comments