| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 04697a5 commit bd4454f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,7 +136,7 @@ | |||
| 136 | 136 | ||
| 137 | 137 | preloadModules(); | |
| 138 | 138 | ||
| 139 | - if (global.v8debug && | ||
| 139 | + if (process._debugWaitConnect && | ||
| 140 | 140 | process.execArgv.some(function(arg) { | |
| 141 | 141 | return arg.match(/^--debug-brk(=[0-9]*)?$/); | |
| 142 | 142 | })) { | |
@@ -149,7 +149,7 @@ | |||
| 149 | 149 | // breakpoint message on line 1. | |
| 150 | 150 | // | |
| 151 | 151 | // A better fix would be to somehow get a message from the | |
| 152 | - // global.v8debug object about a connection, and runMain when | ||
| 152 | + // V8 debug object about a connection, and runMain when | ||
| 153 | 153 | // that occurs. --isaacs | |
| 154 | 154 | ||
| 155 | 155 | var debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ const NativeModule = require('native_module'); | |||
| 4 | 4 | const util = require('util'); | |
| 5 | 5 | const internalModule = require('internal/module'); | |
| 6 | 6 | const internalUtil = require('internal/util'); | |
| 7 | - const runInThisContext = require('vm').runInThisContext; | ||
| 7 | + const vm = require('vm'); | ||
| 8 | 8 | const assert = require('assert').ok; | |
| 9 | 9 | const fs = require('fs'); | |
| 10 | 10 | const path = require('path'); | |
@@ -508,13 +508,13 @@ Module.prototype._compile = function(content, filename) { | |||
| 508 | 508 | // create wrapper function | |
| 509 | 509 | var wrapper = Module.wrap(content); | |
| 510 | 510 | ||
| 511 | - var compiledWrapper = runInThisContext(wrapper, { | ||
| 511 | + var compiledWrapper = vm.runInThisContext(wrapper, { | ||
| 512 | 512 | filename: filename, | |
| 513 | 513 | lineOffset: 0, | |
| 514 | 514 | displayErrors: true | |
| 515 | 515 | }); | |
| 516 | 516 | ||
| 517 | - if (global.v8debug) { | ||
| 517 | + if (process._debugWaitConnect) { | ||
| 518 | 518 | if (!resolvedArgv) { | |
| 519 | 519 | // we enter the repl if we're not given a filename argument. | |
| 520 | 520 | if (process.argv[1]) { | |
@@ -526,11 +526,9 @@ Module.prototype._compile = function(content, filename) { | |||
| 526 | 526 | ||
| 527 | 527 | // Set breakpoint on module start | |
| 528 | 528 | if (filename === resolvedArgv) { | |
| 529 | - // Installing this dummy debug event listener tells V8 to start | ||
| 530 | - // the debugger. Without it, the setBreakPoint() fails with an | ||
| 531 | - // 'illegal access' error. | ||
| 532 | - global.v8debug.Debug.setListener(function() {}); | ||
| 533 | - global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0); | ||
| 529 | + delete process._debugWaitConnect; | ||
| 530 | + const Debug = vm.runInDebugContext('Debug'); | ||
| 531 | + Debug.setBreakPoint(compiledWrapper, 0, 0); | ||
| 534 | 532 | } | |
| 535 | 533 | } | |
| 536 | 534 | var dirname = path.dirname(filename); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3179,6 +3179,11 @@ void SetupProcessObject(Environment* env, | |||
| 3179 | 3179 | READONLY_PROPERTY(process, "traceDeprecation", True(env->isolate())); | |
| 3180 | 3180 | } | |
| 3181 | 3181 | ||
| 3182 | + // --debug-brk | ||
| 3183 | + if (debug_wait_connect) { | ||
| 3184 | + READONLY_PROPERTY(process, "_debugWaitConnect", True(env->isolate())); | ||
| 3185 | + } | ||
| 3186 | + | ||
| 3182 | 3187 | // --security-revert flags | |
| 3183 | 3188 | #define V(code, _, __) \ | |
| 3184 | 3189 | do { \ | |
@@ -4087,11 +4092,6 @@ void Init(int* argc, | |||
| 4087 | 4092 | exit(9); | |
| 4088 | 4093 | } | |
| 4089 | 4094 | ||
| 4090 | - if (debug_wait_connect) { | ||
| 4091 | - const char expose_debug_as[] = "--expose_debug_as=v8debug"; | ||
| 4092 | - V8::SetFlagsFromString(expose_debug_as, sizeof(expose_debug_as) - 1); | ||
| 4093 | - } | ||
| 4094 | - | ||
| 4095 | 4095 | // Unconditionally force typed arrays to allocate outside the v8 heap. This | |
| 4096 | 4096 | // is to prevent memory pointers from being moved around that are returned by | |
| 4097 | 4097 | // Buffer::Data(). | |
| Back | FazBrowse Home | New Git URL |
0 commit comments