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

Unified Diff: test/inspector/debugger/asm-js-stack.js

Issue 2415073003: [debug] [reland] Consistently use script from FrameMirror (Closed)
Patch Set: address comments and minor other fixes Created 4 years, 2 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/inspector/debugger_script_externs.js ('k') | test/inspector/debugger/asm-js-stack-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/asm-js-stack.js
diff --git a/test/inspector/debugger/asm-js-stack.js b/test/inspector/debugger/asm-js-stack.js
new file mode 100644
index 0000000000000000000000000000000000000000..37db088ba19a710ee9fcb9652923b138ab7239bd
--- /dev/null
+++ b/test/inspector/debugger/asm-js-stack.js
@@ -0,0 +1,79 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --validate-asm
+
+function testFunction() {
+ function generateAsmJs(stdlib, foreign, heap) {
+ 'use asm';
+ var debugger_fun = foreign.call_debugger;
+ function callDebugger() {
+ debugger_fun();
+ }
+ function redirectFun() {
+ callDebugger();
+ }
+ return redirectFun;
+ }
+
+ function call_debugger() {
+ debugger;
+ }
+
+ var fun = generateAsmJs(this, {'call_debugger': call_debugger}, undefined);
+ fun();
+}
+
+InspectorTest.addScript(testFunction.toString());
+
+Protocol.Debugger.enable();
+Protocol.Debugger.oncePaused().then(handleDebuggerPaused);
+Protocol.Runtime.evaluate({'expression': 'testFunction()'});
+
+function locationToString(callFrame) {
+ var res = {functionName: callFrame.functionName};
+ for (var attr in callFrame.functionLocation) {
+ if (attr == 'scriptId') continue;
+ res['function_'+attr] = callFrame.functionLocation[attr];
+ }
+ for (var attr in callFrame.location) {
+ if (attr == 'scriptId') continue;
+ res[attr] = callFrame.location[attr];
+ }
+ return JSON.stringify(res);
+}
+
+function logStackTrace(messageObject) {
+ var frames = messageObject.params.callFrames;
+ InspectorTest.log('Number of frames: ' + frames.length);
+ for (var i = 0; i < frames.length; ++i) {
+ InspectorTest.log(' - [' + i + '] ' + locationToString(frames[i]));
+ }
+}
+
+function handleDebuggerPaused(messageObject)
+{
+ InspectorTest.log('Paused on \'debugger;\'');
+ logStackTrace(messageObject);
+ InspectorTest.log('Getting v8-generated stack trace...');
+ var topFrameId = messageObject.params.callFrames[0].callFrameId;
+ Protocol.Debugger
+ .evaluateOnCallFrame({
+ callFrameId: topFrameId,
+ expression: '(new Error("getting stack trace")).stack'
+ })
+ .then(callbackEvaluate);
+}
+
+function callbackEvaluate(response)
+{
+ InspectorTest.log(
+ 'Result of evaluate (' + response.result.result.type + '):');
+ var result_lines = response.result.result.value.split("\n");
+ // Skip the second line, containing the 'evaluate' position.
+ result_lines[1] = " -- skipped --";
+ InspectorTest.log(result_lines.join('\n'));
+ InspectorTest.log('Finished!');
+ InspectorTest.completeTest();
+}
« no previous file with comments | « src/inspector/debugger_script_externs.js ('k') | test/inspector/debugger/asm-js-stack-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698