this.request_ = this.breakCommandToJSONRequest_(args);
break;
+ case 'breakpoints':
+ case 'bb':
+ this.request_ = this.breakpointsCommandToJSONRequest_(args);
+ break;
+
case 'clear':
this.request_ = this.clearCommandToJSONRequest_(args);
break;
};
+DebugRequest.prototype.breakpointsCommandToJSONRequest_ = function(args) {
+ if (args && args.length > 0) {
+ throw new Error('Unexpected arguments.');
+ }
+ var request = this.createRequest('listbreakpoints');
+ return request.toJSONProtocol();
+};
+
+
// Create a JSON request for the clear command.
DebugRequest.prototype.clearCommandToJSONRequest_ = function(args) {
// Build a evaluate request from the text command.
result += body.breakpoint;
details.text = result;
break;
+
+ case 'listbreakpoints':
+ result = 'breakpoints: (' + body.breakpoints.length + ')';
+ for (var i = 0; i < body.breakpoints.length; i++) {
+ var breakpoint = body.breakpoints[i];
+ result += '\n id=' + breakpoint.number;
+ result += ' type=' + breakpoint.type;
+ if (breakpoint.script_id) {
+ result += ' script_id=' + breakpoint.script_id;
+ }
+ if (breakpoint.script_name) {
+ result += ' script_name=' + breakpoint.script_name;
+ }
+ result += ' line=' + breakpoint.line;
+ if (breakpoint.column != null) {
+ result += ' column=' + breakpoint.column;
+ }
+ if (breakpoint.groupId) {
+ result += ' groupId=' + breakpoint.groupId;
+ }
+ if (breakpoint.ignoreCount) {
+ result += ' ignoreCount=' + breakpoint.ignoreCount;
+ }
+ if (breakpoint.active === false) {
+ result += ' inactive';
+ }
+ if (breakpoint.condition) {
+ result += ' condition=' + breakpoint.condition;
+ }
+ result += ' hit_count=' + breakpoint.hit_count;
+ }
+ details.text = result;
+ break;
case 'backtrace':
if (body.totalFrames == 0) {
default:
details.text =
- 'Response for unknown command \'' + response.command + '\'' +
- ' (' + json_response + ')';
+ 'Response for unknown command \'' + response.command() + '\'' +
+ ' (' + response.raw_json() + ')';
}
} catch (e) {
details.text = 'Error: "' + e + '" formatting response';
* @constructor
*/
function ProtocolPackage(json) {
+ this.raw_json_ = json;
this.packet_ = JSON.parse(json);
this.refs_ = [];
if (this.packet_.refs) {
}
+ProtocolPackage.prototype.raw_json = function() {
+ return this.raw_json_;
+}
+
+
function ProtocolValue(value, packet) {
this.value_ = value;
this.packet_ = packet;
this.clearBreakPointRequest_(request, response);
} else if (request.command == 'clearbreakpointgroup') {
this.clearBreakPointGroupRequest_(request, response);
+ } else if (request.command == 'listbreakpoints') {
+ this.listBreakpointsRequest_(request, response);
} else if (request.command == 'backtrace') {
this.backtraceRequest_(request, response);
} else if (request.command == 'frame') {
response.body = { breakpoint: break_point }
}
+DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, response) {
+ var array = [];
+ for (var i = 0; i < script_break_points.length; i++) {
+ var break_point = script_break_points[i];
+
+ var description = {
+ number: break_point.number(),
+ line: break_point.line(),
+ column: break_point.column(),
+ groupId: break_point.groupId(),
+ hit_count: break_point.hit_count(),
+ active: break_point.active(),
+ condition: break_point.condition(),
+ ignoreCount: break_point.ignoreCount()
+ }
+
+ if (break_point.type() == Debug.ScriptBreakPointType.ScriptId) {
+ description.type = 'scriptId';
+ description.script_id = break_point.script_id();
+ } else {
+ description.type = 'scriptName';
+ description.script_name = break_point.script_name();
+ }
+ array.push(description);
+ }
+
+ response.body = { breakpoints: array }
+}
+
DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response) {
// Get the number of frames.