// Set breakpoint on module start
if (filename === resolvedArgv) {
+ // Installing this dummy debug event listener tells V8 to start
+ // the debugger. Without it, the setBreakPoint() fails with an
+ // 'illegal access' error.
+ global.v8debug.Debug.setListener(function() {});
global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
}
}
if (script_source.IsEmpty())
return; // Exception pending.
Local<Context> debug_context = Debug::GetDebugContext();
+ if (debug_context.IsEmpty()) {
+ // Force-load the debug context.
+ Debug::GetMirror(args.GetIsolate()->GetCurrentContext(), args[0]);
+ debug_context = Debug::GetDebugContext();
+ CHECK(!debug_context.IsEmpty());
+ }
Environment* env = Environment::GetCurrent(args);
ScopedEnvironment env_scope(debug_context, env);
Context::Scope context_scope(debug_context);