summaryrefslogtreecommitdiffstats
path: root/src/debug-debugger.js
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2012-04-11 18:30:58 +0100
committerBen Murdoch <benm@google.com>2012-04-11 18:39:07 +0100
commit85b71799222b55eb5dd74ea26efe0c64ab655c8c (patch)
tree0d0fa6be365df4b76fe2985458b3a9b9afd80988 /src/debug-debugger.js
parent5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b (diff)
downloadandroid_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.tar.gz
android_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.tar.bz2
android_external_v8-85b71799222b55eb5dd74ea26efe0c64ab655c8c.zip
Roll V8 back to 3.6
Roll back to V8 3.6 to fix x86 build, we don't have ucontext.h. This reverts commits: 5d4cdbf7a67d3662fa0bee4efdb7edd8daec9b0b c7cc028aaeedbbfa11c11d0b7b243b3d9e837ed9 592a9fc1d8ea420377a2e7efd0600e20b058be2b Bug: 5688872 Change-Id: Ic961bb5e65b778e98bbfb71cce71d99fa949e995
Diffstat (limited to 'src/debug-debugger.js')
-rw-r--r--src/debug-debugger.js158
1 files changed, 71 insertions, 87 deletions
diff --git a/src/debug-debugger.js b/src/debug-debugger.js
index 802f6224..d254ee56 100644
--- a/src/debug-debugger.js
+++ b/src/debug-debugger.js
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2006-2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -26,14 +26,14 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Default number of frames to include in the response to backtrace request.
-var kDefaultBacktraceLength = 10;
+const kDefaultBacktraceLength = 10;
-var Debug = {};
+const Debug = {};
// Regular expression to skip "crud" at the beginning of a source line which is
// not really code. Currently the regular expression matches whitespace and
// comments.
-var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/;
+const sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/;
// Debug events which can occour in the V8 JavaScript engine. These originate
// from the API include file debug.h.
@@ -286,7 +286,7 @@ ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) {
copy.condition_ = this.condition_;
copy.ignoreCount_ = this.ignoreCount_;
return copy;
-};
+}
ScriptBreakPoint.prototype.number = function() {
@@ -335,13 +335,13 @@ ScriptBreakPoint.prototype.actual_locations = function() {
locations.push(this.break_points_[i].actual_location);
}
return locations;
-};
+}
ScriptBreakPoint.prototype.update_positions = function(line, column) {
this.line_ = line;
this.column_ = column;
-};
+}
ScriptBreakPoint.prototype.hit_count = function() {
@@ -477,11 +477,9 @@ ScriptBreakPoint.prototype.clear = function () {
// break points set in this script.
function UpdateScriptBreakPoints(script) {
for (var i = 0; i < script_break_points.length; i++) {
- var break_point = script_break_points[i];
- if ((break_point.type() == Debug.ScriptBreakPointType.ScriptName ||
- break_point.type() == Debug.ScriptBreakPointType.ScriptRegExp) &&
- break_point.matchesScript(script)) {
- break_point.set(script);
+ if (script_break_points[i].type() == Debug.ScriptBreakPointType.ScriptName &&
+ script_break_points[i].matchesScript(script)) {
+ script_break_points[i].set(script);
}
}
}
@@ -587,7 +585,7 @@ Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) {
var script = %FunctionGetScript(func);
var script_offset = %FunctionGetScriptSourcePosition(func);
return script.locationFromLine(opt_line, opt_column, script_offset);
-};
+}
// Returns the character position in a script based on a line number and an
@@ -595,7 +593,7 @@ Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) {
Debug.findScriptSourcePosition = function(script, opt_line, opt_column) {
var location = script.locationFromLine(opt_line, opt_column);
return location ? location.position : null;
-};
+}
Debug.findBreakPoint = function(break_point_number, remove) {
@@ -629,7 +627,7 @@ Debug.findBreakPointActualLocations = function(break_point_number) {
}
}
return [];
-};
+}
Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.');
@@ -679,9 +677,8 @@ Debug.setBreakPointByScriptIdAndPosition = function(script_id, position,
{
break_point = MakeBreakPoint(position);
break_point.setCondition(condition);
- if (!enabled) {
+ if (!enabled)
break_point.disable();
- }
var scripts = this.scripts();
for (var i = 0; i < scripts.length; i++) {
if (script_id == scripts[i].id) {
@@ -774,7 +771,7 @@ Debug.findScriptBreakPoint = function(break_point_number, remove) {
}
}
return script_break_point;
-};
+}
// Sets a breakpoint in a script identified through id or name at the
@@ -802,7 +799,7 @@ Debug.setScriptBreakPoint = function(type, script_id_or_name,
}
return script_break_point.number();
-};
+}
Debug.setScriptBreakPointById = function(script_id,
@@ -811,7 +808,7 @@ Debug.setScriptBreakPointById = function(script_id,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
script_id, opt_line, opt_column,
opt_condition, opt_groupId);
-};
+}
Debug.setScriptBreakPointByName = function(script_name,
@@ -820,7 +817,7 @@ Debug.setScriptBreakPointByName = function(script_name,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptName,
script_name, opt_line, opt_column,
opt_condition, opt_groupId);
-};
+}
Debug.setScriptBreakPointByRegExp = function(script_regexp,
@@ -829,7 +826,7 @@ Debug.setScriptBreakPointByRegExp = function(script_regexp,
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptRegExp,
script_regexp, opt_line, opt_column,
opt_condition, opt_groupId);
-};
+}
Debug.enableScriptBreakPoint = function(break_point_number) {
@@ -844,15 +841,13 @@ Debug.disableScriptBreakPoint = function(break_point_number) {
};
-Debug.changeScriptBreakPointCondition = function(
- break_point_number, condition) {
+Debug.changeScriptBreakPointCondition = function(break_point_number, condition) {
var script_break_point = this.findScriptBreakPoint(break_point_number, false);
script_break_point.setCondition(condition);
};
-Debug.changeScriptBreakPointIgnoreCount = function(
- break_point_number, ignoreCount) {
+Debug.changeScriptBreakPointIgnoreCount = function(break_point_number, ignoreCount) {
if (ignoreCount < 0) {
throw new Error('Invalid argument');
}
@@ -863,12 +858,12 @@ Debug.changeScriptBreakPointIgnoreCount = function(
Debug.scriptBreakPoints = function() {
return script_break_points;
-};
+}
Debug.clearStepping = function() {
%ClearStepping();
-};
+}
Debug.setBreakOnException = function() {
return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, true);
@@ -945,7 +940,7 @@ ExecutionState.prototype.prepareStep = function(opt_action, opt_count) {
var count = opt_count ? %ToNumber(opt_count) : 1;
return %PrepareStep(this.break_id, action, count);
-};
+}
ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
opt_additional_context) {
@@ -965,9 +960,8 @@ ExecutionState.prototype.threadCount = function() {
ExecutionState.prototype.frame = function(opt_index) {
// If no index supplied return the selected frame.
if (opt_index == null) opt_index = this.selected_frame;
- if (opt_index < 0 || opt_index >= this.frameCount()) {
+ if (opt_index < 0 || opt_index >= this.frameCount())
throw new Error('Illegal frame index.');
- }
return new FrameMirror(this.break_id, opt_index);
};
@@ -1094,12 +1088,12 @@ ExceptionEvent.prototype.eventType = function() {
ExceptionEvent.prototype.exception = function() {
return this.exception_;
-};
+}
ExceptionEvent.prototype.uncaught = function() {
return this.uncaught_;
-};
+}
ExceptionEvent.prototype.func = function() {
@@ -1191,7 +1185,7 @@ CompileEvent.prototype.toJSONProtocol = function() {
o.body.script = this.script_;
return o.toJSONProtocol();
-};
+}
function MakeNewFunctionEvent(func) {
@@ -1247,7 +1241,7 @@ ScriptCollectedEvent.prototype.toJSONProtocol = function() {
o.body = {};
o.body.script = { id: this.id() };
return o.toJSONProtocol();
-};
+}
function MakeScriptObject_(script, include_source) {
@@ -1264,18 +1258,18 @@ function MakeScriptObject_(script, include_source) {
o.source = script.source();
}
return o;
-}
+};
function DebugCommandProcessor(exec_state, opt_is_running) {
this.exec_state_ = exec_state;
this.running_ = opt_is_running || false;
-}
+};
DebugCommandProcessor.prototype.processDebugRequest = function (request) {
return this.processDebugJSONRequest(request);
-};
+}
function ProtocolMessage(request) {
@@ -1303,13 +1297,13 @@ ProtocolMessage.prototype.setOption = function(name, value) {
this.options_ = {};
}
this.options_[name] = value;
-};
+}
ProtocolMessage.prototype.failed = function(message) {
this.success = false;
this.message = message;
-};
+}
ProtocolMessage.prototype.toJSONProtocol = function() {
@@ -1357,7 +1351,7 @@ ProtocolMessage.prototype.toJSONProtocol = function() {
}
json.running = this.running;
return JSON.stringify(json);
-};
+}
DebugCommandProcessor.prototype.createResponse = function(request) {
@@ -1365,8 +1359,7 @@ DebugCommandProcessor.prototype.createResponse = function(request) {
};
-DebugCommandProcessor.prototype.processDebugJSONRequest = function(
- json_request) {
+DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request) {
var request; // Current request.
var response; // Generated response.
try {
@@ -1548,7 +1541,7 @@ DebugCommandProcessor.prototype.continueRequest_ = function(request, response) {
}
}
- // Set up the VM for stepping.
+ // Setup the VM for stepping.
this.exec_state_.prepareStep(action, count);
}
@@ -1653,7 +1646,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
// Add the break point number to the response.
response.body = { type: type,
- breakpoint: break_point_number };
+ breakpoint: break_point_number }
// Add break point information to the response.
if (break_point instanceof ScriptBreakPoint) {
@@ -1667,8 +1660,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
response.body.type = 'scriptRegExp';
response.body.script_regexp = break_point.script_regexp_object().source;
} else {
- throw new Error("Internal error: Unexpected breakpoint type: " +
- break_point.type());
+ throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
}
response.body.line = break_point.line();
response.body.column = break_point.column();
@@ -1680,8 +1672,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
};
-DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
- request, response) {
+DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
@@ -1718,11 +1709,10 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
if (!IS_UNDEFINED(ignoreCount)) {
Debug.changeBreakPointIgnoreCount(break_point, ignoreCount);
}
-};
+}
-DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(
- request, response) {
+DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
@@ -1753,11 +1743,10 @@ DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(
// Add the cleared break point numbers to the response.
response.body = { breakpoints: cleared_break_points };
-};
+}
-DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(
- request, response) {
+DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(request, response) {
// Check for legal request.
if (!request.arguments) {
response.failed('Missing arguments');
@@ -1777,12 +1766,11 @@ DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(
Debug.clearBreakPoint(break_point);
// Add the cleared break point number to the response.
- response.body = { breakpoint: break_point };
-};
+ response.body = { breakpoint: break_point }
+}
-DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
- request, response) {
+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];
@@ -1797,7 +1785,7 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
condition: break_point.condition(),
ignoreCount: break_point.ignoreCount(),
actual_locations: break_point.actual_locations()
- };
+ }
if (break_point.type() == Debug.ScriptBreakPointType.ScriptId) {
description.type = 'scriptId';
@@ -1809,8 +1797,7 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
description.type = 'scriptRegExp';
description.script_regexp = break_point.script_regexp_object().source;
} else {
- throw new Error("Internal error: Unexpected breakpoint type: " +
- break_point.type());
+ throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
}
array.push(description);
}
@@ -1819,15 +1806,15 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
breakpoints: array,
breakOnExceptions: Debug.isBreakOnException(),
breakOnUncaughtExceptions: Debug.isBreakOnUncaughtException()
- };
-};
+ }
+}
DebugCommandProcessor.prototype.disconnectRequest_ =
function(request, response) {
Debug.disableAllBreakPoints();
this.continueRequest_(request, response);
-};
+}
DebugCommandProcessor.prototype.setExceptionBreakRequest_ =
@@ -1872,11 +1859,10 @@ DebugCommandProcessor.prototype.setExceptionBreakRequest_ =
// Add the cleared break point number to the response.
response.body = { 'type': type, 'enabled': enabled };
-};
+}
-DebugCommandProcessor.prototype.backtraceRequest_ = function(
- request, response) {
+DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response) {
// Get the number of frames.
var total_frames = this.exec_state_.frameCount();
@@ -1884,12 +1870,12 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(
if (total_frames == 0) {
response.body = {
totalFrames: total_frames
- };
+ }
return;
}
// Default frame range to include in backtrace.
- var from_index = 0;
+ var from_index = 0
var to_index = kDefaultBacktraceLength;
// Get the range from the arguments.
@@ -1902,7 +1888,7 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(
}
if (request.arguments.bottom) {
var tmp_index = total_frames - from_index;
- from_index = total_frames - to_index;
+ from_index = total_frames - to_index
to_index = tmp_index;
}
if (from_index < 0 || to_index < 0) {
@@ -1928,7 +1914,7 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(
toFrame: to_index,
totalFrames: total_frames,
frames: frames
- };
+ }
};
@@ -1952,8 +1938,8 @@ DebugCommandProcessor.prototype.frameRequest_ = function(request, response) {
DebugCommandProcessor.prototype.frameForScopeRequest_ = function(request) {
- // Get the frame for which the scope or scopes are requested.
- // With no frameNumber argument use the currently selected frame.
+ // Get the frame for which the scope or scopes are requested. With no frameNumber
+ // argument use the currently selected frame.
if (request.arguments && !IS_UNDEFINED(request.arguments.frameNumber)) {
frame_index = request.arguments.frameNumber;
if (frame_index < 0 || this.exec_state_.frameCount() <= frame_index) {
@@ -1963,7 +1949,7 @@ DebugCommandProcessor.prototype.frameForScopeRequest_ = function(request) {
} else {
return this.exec_state_.frame();
}
-};
+}
DebugCommandProcessor.prototype.scopesRequest_ = function(request, response) {
@@ -1986,7 +1972,7 @@ DebugCommandProcessor.prototype.scopesRequest_ = function(request, response) {
toScope: total_scopes,
totalScopes: total_scopes,
scopes: scopes
- };
+ }
};
@@ -2231,8 +2217,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) {
if (!IS_UNDEFINED(request.arguments.types)) {
types = %ToNumber(request.arguments.types);
if (isNaN(types) || types < 0) {
- return response.failed('Invalid types "' +
- request.arguments.types + '"');
+ return response.failed('Invalid types "' + request.arguments.types + '"');
}
}
@@ -2301,7 +2286,7 @@ DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) {
var details = %GetThreadDetails(this.exec_state_.break_id, i);
var thread_info = { current: details[0],
id: details[1]
- };
+ }
threads.push(thread_info);
}
@@ -2309,7 +2294,7 @@ DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) {
response.body = {
totalThreads: total_threads,
threads: threads
- };
+ }
};
@@ -2321,7 +2306,7 @@ DebugCommandProcessor.prototype.suspendRequest_ = function(request, response) {
DebugCommandProcessor.prototype.versionRequest_ = function(request, response) {
response.body = {
V8Version: %GetV8Version()
- };
+ }
};
@@ -2337,8 +2322,7 @@ DebugCommandProcessor.prototype.profileRequest_ = function(request, response) {
};
-DebugCommandProcessor.prototype.changeLiveRequest_ = function(
- request, response) {
+DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) {
if (!Debug.LiveEdit) {
return response.failed('LiveEdit feature is not supported');
}
@@ -2409,7 +2393,7 @@ DebugCommandProcessor.prototype.debuggerFlagsRequest_ = function(request,
response.body.flags.push({ name: name, value: value });
}
}
-};
+}
DebugCommandProcessor.prototype.v8FlagsRequest_ = function(request, response) {
@@ -2515,7 +2499,7 @@ DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) {
// running.
DebugCommandProcessor.prototype.isRunning = function() {
return this.running_;
-};
+}
DebugCommandProcessor.prototype.systemBreak = function(cmd, args) {
@@ -2531,7 +2515,7 @@ function NumberToHex8Str(n) {
n = n >>> 4;
}
return r;
-}
+};
/**
@@ -2607,7 +2591,7 @@ function ValueToProtocolValue_(value, mirror_serializer) {
case 'string':
case 'number':
json = value;
- break;
+ break
default:
json = null;