Inspect C++ pointers, references and arrays

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.

Steps

  1. Get the C/C++ DevTools helper extension
  2. Open DevTools
  3. 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.
  4. Reload DevTools as prompted on the banner after closing the settings
  5. Wait until the demo-cpp.cc module shows up
  6. Locate the function main from the demo-cpp.cc module and set a breakpoint on line 15: x[i] = n - i - 1
  7. Reload the page
  8. 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"
  9. Clear the breakpoint
  10. Locate the function calcSum and set a new breakpoint on line 4 at for(int i = 0; i < length; ++i) {
  11. Resume to hit the breakpoint
  12. Inspect the Scope View. The Local Scope shows the static pointer x and the reference sum.
  13. Open the linear memory inspector by