This tests that we can view the memory of pointers, references and arrays. Note: this only works with the C/C++ DevTools helper extension. See below for instructions to get it.
Enable the Wasm Debugging Experiment: click the gear icon on the top right corner of DevTools, go to Experiments and tick the WebAssembly Debugging: Enable DWARF support. See this blogpost for more information.
Reload DevTools as prompted on the banner after closing the settings
Wait until the demo-cpp.cc module shows up
Locate the function main from the demo-cpp.cc module and set a breakpoint on line 15: x[i] = n - i - 1
Reload the page
Inspect the Scope View. The Local Scope shows the static array x. Inspect it by right clicking on x and selecting "Reveal in Memory Inspector panel"
Clear the breakpoint
Locate the function calcSum and set a new breakpoint on line 4 at for(int i = 0; i < length; ++i) {
Resume to hit the breakpoint
Inspect the Scope View. The Local Scope shows the static pointer x and the reference sum.
Open the linear memory inspector by
right clicking on the referencesum and selecting "Reveal in Memory Inspector panel"
right clicking on the pointerx and selecting "Reveal in Memory Inspector panel"