This commit is contained in:
Danny Coates 2010-12-14 18:29:12 -07:00
Родитель d6d2ba81b1
Коммит d0deaacf9b
3 изменённых файлов: 73 добавлений и 63 удалений

Просмотреть файл

@ -1,3 +1,7 @@
v0.1.6
* fixed crash on connect when using watch expressions (Issue 25)
v0.1.5
* minor bug fixes

Просмотреть файл

@ -231,6 +231,73 @@ exports.create = function(conn, debugr, debuggerPort, config) {
}));
}
function attach() {
debug = debugr.attachDebugger(debuggerPort);
debug.on('break', breakEvent);
debug.on('close', function() {
//TODO determine proper close behavior
debug = {
request: function() {
console.error('debugger not connected');
}
};
sendEvent('debuggerWasDisabled');
});
debug.on('connect', function() {
sendEvent('debuggerWasEnabled');
var args = { arguments: { includeSource: true, types: 4 }};
debug.request('scripts', args, function(msg) {
parsedScripts(msg);
debug.request('listbreakpoints', {},
function(msg) {
msg.body.breakpoints.forEach(function(bp) {
var data;
if (bp.type === 'scriptId') {
data = {
sourceID: bp.script_id,
url: sourceIDs[bp.script_id].url,
line: bp.line + 1,
enabled: bp.active,
condition: bp.condition,
number: bp.number
};
breakpoints[bp.script_id + ':' + (bp.line + 1)] = data;
sendEvent('restoredBreakpoint', data);
}
});
if (!msg.running) {
sendBacktrace();
}
});
});
});
debug.on('exception', function(msg) {
breakEvent(msg);
});
debug.on('error', function(e) {
sendEvent('showPanel', { name: 'console' });
var err = e.toString(), data;
if (err.match(/ECONNREFUSED/)) {
err += '\nIs node running with --debug port ' + debuggerPort + '?';
}
data = {
messageObj: {
source: 3,
type: 0,
level: 3,
line: 0,
url: '',
groupLevel: 7,
repeatCount: 1,
message: err
}
};
sendEvent('addConsoleMessage', data);
});
}
attach();
return Object.create(events.EventEmitter.prototype, {
close: {
value: function()
@ -244,67 +311,7 @@ exports.create = function(conn, debugr, debuggerPort, config) {
//Backend
enableDebugger: {
value: function(always) {
debug = debugr.attachDebugger(debuggerPort);
debug.on('break', breakEvent);
debug.on('close', function() {
//TODO determine proper close behavior
debug = {
request: function() {
console.error('debugger not connected');
}
};
sendEvent('debuggerWasDisabled');
});
debug.on('connect', function() {
var args = { arguments: { includeSource: true, types: 4 }};
debug.request('scripts', args, function(msg) {
parsedScripts(msg);
debug.request('listbreakpoints', {},
function(msg) {
msg.body.breakpoints.forEach(function(bp) {
var data;
if (bp.type === 'scriptId') {
data = {
sourceID: bp.script_id,
url: sourceIDs[bp.script_id].url,
line: bp.line + 1,
enabled: bp.active,
condition: bp.condition,
number: bp.number
};
breakpoints[bp.script_id + ':' + (bp.line + 1)] = data;
sendEvent('restoredBreakpoint', data);
}
});
if (!msg.running) {
sendBacktrace();
}
});
});
});
debug.on('exception', function(msg) {
breakEvent(msg);
});
debug.on('error', function(e) {
sendEvent('showPanel', { name: 'console' });
var err = e.toString(), data;
if (err.match(/ECONNREFUSED/)) {
err += '\nIs node running with --debug port ' + debuggerPort + '?';
}
data = {
messageObj: {
source: 3,
type: 0,
level: 3,
line: 0,
url: '',
groupLevel: 7,
repeatCount: 1,
message: err
}
};
sendEvent('addConsoleMessage', data);
});
attach();
}
},
dispatchOnInjectedScript: {
@ -473,7 +480,6 @@ exports.create = function(conn, debugr, debuggerPort, config) {
populateScriptObjects: {
value: function(seq) {
sendResponse(seq, true, {});
this.enableDebugger();
}
},
getInspectorState: {

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "node-inspector",
"version": "0.1.5",
"version": "0.1.6",
"description": "Web Inspector based nodeJS debugger",
"homepage": "http://github.com/dannycoates/node-inspector",
"author": "Danny Coates <dannycoates@gmail.com>",