Index: src/mirror-debugger.js |
=================================================================== |
--- src/mirror-debugger.js (revision 4834) |
+++ src/mirror-debugger.js (working copy) |
@@ -1240,8 +1240,9 @@ |
const kFrameDetailsLocalCountIndex = 4; |
const kFrameDetailsSourcePositionIndex = 5; |
const kFrameDetailsConstructCallIndex = 6; |
-const kFrameDetailsDebuggerFrameIndex = 7; |
-const kFrameDetailsFirstDynamicIndex = 8; |
+const kFrameDetailsAtReturnIndex = 7; |
+const kFrameDetailsDebuggerFrameIndex = 8; |
+const kFrameDetailsFirstDynamicIndex = 9; |
const kFrameDetailsNameIndex = 0; |
const kFrameDetailsValueIndex = 1; |
@@ -1258,8 +1259,11 @@ |
* 4: Local count |
* 5: Source position |
* 6: Construct call |
+ * 7: Is at return |
+ * 8: Debugger frame |
* Arguments name, value |
* Locals name, value |
+ * Return value if any |
* @param {number} break_id Current break id |
* @param {number} index Frame number |
* @constructor |
@@ -1294,6 +1298,12 @@ |
} |
+FrameDetails.prototype.isAtReturn = function() { |
+ %CheckExecutionState(this.break_id_); |
+ return this.details_[kFrameDetailsAtReturnIndex]; |
+} |
+ |
+ |
FrameDetails.prototype.isDebuggerFrame = function() { |
%CheckExecutionState(this.break_id_); |
return this.details_[kFrameDetailsDebuggerFrameIndex]; |
@@ -1341,7 +1351,8 @@ |
FrameDetails.prototype.localName = function(index) { |
%CheckExecutionState(this.break_id_); |
if (index >= 0 && index < this.localCount()) { |
- var locals_offset = kFrameDetailsFirstDynamicIndex + this.argumentCount() * kFrameDetailsNameValueSize |
+ var locals_offset = kFrameDetailsFirstDynamicIndex + |
+ this.argumentCount() * kFrameDetailsNameValueSize |
return this.details_[locals_offset + |
index * kFrameDetailsNameValueSize + |
kFrameDetailsNameIndex] |
@@ -1352,7 +1363,8 @@ |
FrameDetails.prototype.localValue = function(index) { |
%CheckExecutionState(this.break_id_); |
if (index >= 0 && index < this.localCount()) { |
- var locals_offset = kFrameDetailsFirstDynamicIndex + this.argumentCount() * kFrameDetailsNameValueSize |
+ var locals_offset = kFrameDetailsFirstDynamicIndex + |
+ this.argumentCount() * kFrameDetailsNameValueSize |
return this.details_[locals_offset + |
index * kFrameDetailsNameValueSize + |
kFrameDetailsValueIndex] |
@@ -1360,6 +1372,17 @@ |
} |
+FrameDetails.prototype.returnValue = function() { |
+ %CheckExecutionState(this.break_id_); |
+ var return_value_offset = |
+ kFrameDetailsFirstDynamicIndex + |
+ (this.argumentCount() + this.localCount()) * kFrameDetailsNameValueSize; |
+ if (this.details_[kFrameDetailsAtReturnIndex]) { |
+ return this.details_[return_value_offset]; |
+ } |
+} |
+ |
+ |
FrameDetails.prototype.scopeCount = function() { |
return %GetScopeCount(this.break_id_, this.frameId()); |
} |
@@ -1412,6 +1435,11 @@ |
}; |
+FrameMirror.prototype.isAtReturn = function() { |
+ return this.details_.isAtReturn(); |
+}; |
+ |
+ |
FrameMirror.prototype.isDebuggerFrame = function() { |
return this.details_.isDebuggerFrame(); |
}; |
@@ -1447,6 +1475,11 @@ |
}; |
+FrameMirror.prototype.returnValue = function() { |
+ return MakeMirror(this.details_.returnValue()); |
+}; |
+ |
+ |
FrameMirror.prototype.sourcePosition = function() { |
return this.details_.sourcePosition(); |
}; |
@@ -1574,6 +1607,11 @@ |
result += ')'; |
} |
+ if (this.isAtReturn()) { |
+ result += ' returning '; |
+ result += this.returnValue().toText(); |
+ } |
+ |
return result; |
} |
@@ -2267,6 +2305,10 @@ |
content.script = this.serializeReference(func.script()); |
} |
content.constructCall = mirror.isConstructCall(); |
+ content.atReturn = mirror.isAtReturn(); |
+ if (mirror.isAtReturn()) { |
+ content.returnValue = this.serializeReference(mirror.returnValue()); |
+ } |
content.debuggerFrame = mirror.isDebuggerFrame(); |
var x = new Array(mirror.argumentCount()); |
for (var i = 0; i < mirror.argumentCount(); i++) { |