|
|
@ -1217,9 +1217,19 @@ Interface.prototype.setBreakpoint = function(script, line, |
|
|
|
line = this.client.currentSourceLine + 1; |
|
|
|
} |
|
|
|
|
|
|
|
if (/\(\)$/.test(script)) { |
|
|
|
// setBreakpoint('functionname()');
|
|
|
|
var req = { |
|
|
|
type: 'function', |
|
|
|
target: script.replace(/\(\)$/, ''), |
|
|
|
condition: condition |
|
|
|
}; |
|
|
|
} else { |
|
|
|
// setBreakpoint('scriptname')
|
|
|
|
if (script != +script && !this.client.scripts[script]) { |
|
|
|
Object.keys(this.client.scripts).forEach(function(id) { |
|
|
|
if (self.client.scripts[id].name.indexOf(script) !== -1) { |
|
|
|
var scripts = this.client.scripts; |
|
|
|
Object.keys(scripts).forEach(function(id) { |
|
|
|
if (scripts[id] && scripts[id].name.indexOf(script) !== -1) { |
|
|
|
if (scriptId) { |
|
|
|
ambiguous = true; |
|
|
|
} |
|
|
@ -1240,6 +1250,7 @@ Interface.prototype.setBreakpoint = function(script, line, |
|
|
|
line: line - 1, |
|
|
|
condition: condition |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
self.pause(); |
|
|
|
self.client.setBreakpoint(req, function(res) { |
|
|
@ -1247,6 +1258,15 @@ Interface.prototype.setBreakpoint = function(script, line, |
|
|
|
if (!silent) { |
|
|
|
self.list(5); |
|
|
|
} |
|
|
|
|
|
|
|
// Try load scriptId and line from response
|
|
|
|
if (!scriptId) { |
|
|
|
scriptId = res.body.script_id; |
|
|
|
line = res.body.line; |
|
|
|
} |
|
|
|
|
|
|
|
// If we finally have one - remember this breakpoint
|
|
|
|
if (scriptId) { |
|
|
|
self.client.breakpoints.push({ |
|
|
|
id: res.body.breakpoint, |
|
|
|
scriptId: scriptId, |
|
|
@ -1254,10 +1274,11 @@ Interface.prototype.setBreakpoint = function(script, line, |
|
|
|
line: line, |
|
|
|
condition: condition |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (!silent) { |
|
|
|
self.print(req.message || 'error!'); |
|
|
|
self.print(res.message || 'error!'); |
|
|
|
} |
|
|
|
} |
|
|
|
self.resume(); |
|
|
|