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

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

Issue 2420093002: [wasm] Add inspector test for stack traces (Closed)
Patch Set: 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 | « no previous file | test/inspector/debugger/wasm-stack-expected.txt » ('j') | test/inspector/testcfg.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/inspector/debugger/wasm-stack.js
diff --git a/test/inspector/debugger/asm-js-stack.js b/test/inspector/debugger/wasm-stack.js
similarity index 65%
copy from test/inspector/debugger/asm-js-stack.js
copy to test/inspector/debugger/wasm-stack.js
index 37db088ba19a710ee9fcb9652923b138ab7239bd..22fdded3e1bfd45e6d33bd8a661353ae89c822f8 100644
--- a/test/inspector/debugger/asm-js-stack.js
+++ b/test/inspector/debugger/wasm-stack.js
@@ -2,34 +2,46 @@
// 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;
- }
+// Flags: --expose-wasm test/mjsunit/wasm/wasm-constants.js test/mjsunit/wasm/wasm-module-builder.js
+
+var builder = new WasmModuleBuilder();
+
+var imported_idx = builder.addImport("func", kSig_v_v);
+
+var call_imported_idx = builder.addFunction("main", kSig_v_v)
+ .addBody([kExprCallFunction, imported_idx])
+ .index;
+
+builder.addFunction("main", kSig_v_v)
+ .addBody([kExprCallFunction, call_imported_idx])
+ .exportAs("main");
+var module_bytes = builder.toArray();
+
+function testFunction(bytes) {
function call_debugger() {
debugger;
}
- var fun = generateAsmJs(this, {'call_debugger': call_debugger}, undefined);
- fun();
+ var buffer = new ArrayBuffer(bytes.length);
+ var view = new Uint8Array(buffer);
+ for (var i = 0; i < bytes.length; i++) {
+ view[i] = bytes[i] | 0;
+ }
+
+ var module = new WebAssembly.Module(buffer);
+ var instance = new WebAssembly.Instance(module, {func: call_debugger});
+
+ instance.exports.main();
}
InspectorTest.addScript(testFunction.toString());
Protocol.Debugger.enable();
Protocol.Debugger.oncePaused().then(handleDebuggerPaused);
-Protocol.Runtime.evaluate({'expression': 'testFunction()'});
+InspectorTest.log('Running testFunction with generated WASM bytes...');
+Protocol.Runtime.evaluate(
+ {'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'});
function locationToString(callFrame) {
var res = {functionName: callFrame.functionName};
« no previous file with comments | « no previous file | test/inspector/debugger/wasm-stack-expected.txt » ('j') | test/inspector/testcfg.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698