Files
react-native-devtools-frontend/test/e2e/resources/sources/wasm/memory.html
T
Kim-Anh Tran 6eaa725c4e [LMI] Rename 'Inspect memory' to 'Reveal in Memory Inspector panel'
This changes the text in the context menu for revealing the
linear memory inspector.

Fixed: chromium:1163808
Change-Id: I4ab6e882d5be885e68c6b593923f0e426948edd5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2639833
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2021-01-20 07:28:02 +00:00

49 lines
1.6 KiB
HTML

<!--
Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<title>Memory</title>
<script>
(async () => {
const memory = new WebAssembly.Memory({initial: 100});
const string = "Hello this is a string in wasm memory!";
const int8Array = new Uint8Array(memory.buffer);
for (var i = 0; i < string.length; ++i) {
int8Array[i] = string.charCodeAt(i);
}
const numInts = string.length + 1000;
for (var i = string.length; i < numInts; ++i) {
int8Array[i] = i;
}
const importObj = {imports: {memory}};
const instance = await WebAssembly.instantiateStreaming(fetch('memory.wasm'), importObj);
instance.instance.exports.get(42);
})();
</script>
</head>
<body>
<h1>Memory</h1>
<p>
This tests that we can inspect the Wasm memory in the linear memory inspector.
</p>
<h2>Steps</h2>
<p>
<ol>
<li>Open DevTools</li>
<li>Locate the Wasm function <code>get</code> from the <code>memory.wasm</code> module and set a breakpoint on the <code>i32.load</code> line</li>
<li>Reload the page</button></li>
<li>Breakpoint should hit the new breakpoint</button></li>
<li>Now look at the Scope in the DevTools and right click on the <code>imports.memory</code></li>
<li>Select "Reveal in Memory Inspector panel"</li>
<li>The linear memory inspector should open</li>
<li>Inspect memory and navigate</li>
</ol>
</p>
</body>
</html>