Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1014)

Unified Diff: test/mjsunit/debug-backtrace.js

Issue 109026: Add inferred function name to the json protocol (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/mirror-unresolved-function.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/debug-backtrace.js
===================================================================
--- test/mjsunit/debug-backtrace.js (revision 1863)
+++ test/mjsunit/debug-backtrace.js (working copy)
@@ -32,11 +32,15 @@
a=1;
};
-function g() {
+var m = function() {
new f(1);
};
+function g() {
+ m();
+};
+
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
@@ -90,22 +94,26 @@
// Get the backtrace.
var json;
json = '{"seq":0,"type":"request","command":"backtrace"}'
- response = new ParsedResponse(dcp.processDebugJSONRequest(json));
+ var resp = dcp.processDebugJSONRequest(json);
+ response = new ParsedResponse(resp);
backtrace = response.body();
assertEquals(0, backtrace.fromFrame);
- assertEquals(3, backtrace.toFrame);
- assertEquals(3, backtrace.totalFrames);
+ assertEquals(4, backtrace.toFrame);
+ assertEquals(4, backtrace.totalFrames);
var frames = backtrace.frames;
- assertEquals(3, frames.length);
+ assertEquals(4, frames.length);
for (var i = 0; i < frames.length; i++) {
assertEquals('frame', frames[i].type);
}
assertEquals(0, frames[0].index);
assertEquals("f", response.lookup(frames[0].func.ref).name);
assertEquals(1, frames[1].index);
- assertEquals("g", response.lookup(frames[1].func.ref).name);
+ assertEquals("", response.lookup(frames[1].func.ref).name);
+ assertEquals("m", response.lookup(frames[1].func.ref).inferredName);
assertEquals(2, frames[2].index);
- assertEquals("", response.lookup(frames[2].func.ref).name);
+ assertEquals("g", response.lookup(frames[2].func.ref).name);
+ assertEquals(3, frames[3].index);
+ assertEquals("", response.lookup(frames[3].func.ref).name);
// Get backtrace with two frames.
json = '{"seq":0,"type":"request","command":"backtrace","arguments":{"fromFrame":1,"toFrame":3}}'
@@ -113,16 +121,17 @@
backtrace = response.body();
assertEquals(1, backtrace.fromFrame);
assertEquals(3, backtrace.toFrame);
- assertEquals(3, backtrace.totalFrames);
+ assertEquals(4, backtrace.totalFrames);
var frames = backtrace.frames;
assertEquals(2, frames.length);
for (var i = 0; i < frames.length; i++) {
assertEquals('frame', frames[i].type);
}
assertEquals(1, frames[0].index);
- assertEquals("g", response.lookup(frames[0].func.ref).name);
+ assertEquals("", response.lookup(frames[0].func.ref).name);
+ assertEquals("m", response.lookup(frames[0].func.ref).inferredName);
assertEquals(2, frames[1].index);
- assertEquals("", response.lookup(frames[1].func.ref).name);
+ assertEquals("g", response.lookup(frames[1].func.ref).name);
// Get the individual frames.
json = '{"seq":0,"type":"request","command":"frame"}'
@@ -158,16 +167,17 @@
response = new ParsedResponse(dcp.processDebugJSONRequest(json));
frame = response.body();
assertEquals(1, frame.index);
- assertEquals("g", response.lookup(frame.func.ref).name);
+ assertEquals("", response.lookup(frame.func.ref).name);
+ assertEquals("m", response.lookup(frame.func.ref).inferredName);
assertFalse(frame.constructCall);
assertEquals(35, frame.line);
assertEquals(2, frame.column);
assertEquals(0, frame.arguments.length);
- json = '{"seq":0,"type":"request","command":"frame","arguments":{"number":2}}'
+ json = '{"seq":0,"type":"request","command":"frame","arguments":{"number":3}}'
response = new ParsedResponse(dcp.processDebugJSONRequest(json));
frame = response.body();
- assertEquals(2, frame.index);
+ assertEquals(3, frame.index);
assertEquals("", response.lookup(frame.func.ref).name);
// Source slices for the individual frames (they all refer to this script).
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/mirror-unresolved-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698