Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2012-01-24 20:45:34 +0400
committerFedor Indutny <fedor.indutny@gmail.com>2012-01-24 21:13:37 +0400
commit27c85727edda169cbe9c04178c6fdee642cb8845 (patch)
treeea341521f37e251b90171c27c3d410bf2976b0a0 /lib
parente806ad39d0cf13800e21edd7ffd56f707e92b08d (diff)
module: fix --debug-brk on symlinked scripts
* fixes #1519
Diffstat (limited to 'lib')
-rw-r--r--lib/module.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/module.js b/lib/module.js
index 62e5aca0005..b0ce0d2e3fe 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -360,6 +360,11 @@ Module.prototype.require = function(path) {
};
+// Resolved path to process.argv[1] will be lazily placed here
+// (needed for setting breakpoint when called with --debug-brk)
+var resolvedArgv;
+
+
// Returns exception if any
Module.prototype._compile = function(content, filename) {
var self = this;
@@ -427,8 +432,15 @@ Module.prototype._compile = function(content, filename) {
var wrapper = Module.wrap(content);
var compiledWrapper = runInThisContext(wrapper, filename, true);
- if (filename === process.argv[1] && global.v8debug) {
- global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
+ if (global.v8debug) {
+ if (!resolvedArgv) {
+ resolvedArgv = Module._resolveFilename(process.argv[1], null)[1];
+ }
+
+ // Set breakpoint on module start
+ if (filename === resolvedArgv) {
+ global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
+ }
}
var args = [self.exports, require, self, filename, dirname];
return compiledWrapper.apply(self.exports, args);