Feature description: Even for the MVP, we need some debugging story. This bug tracks the progress on that. Design doc: https://docs.google.com/a/chromium.org/document/d/1u24T3QvUrUfakdtorIPvqc11IRMKQ1OI-d2J8mPo0mE/edit?usp=sharing All the CLs towards this goal should have no impact to developers who do not run WebAssembly modules.
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/12aa132d873da628971f0610a987bcef302d9d9f commit 12aa132d873da628971f0610a987bcef302d9d9f Author: clemensh <clemensh@chromium.org> Date: Thu Jun 16 07:48:32 2016 [wasm] Implement AST printing into an ostream This will be used for disassembling individual wasm function for showing them in devtools. The PrintAst function now also optionally provides an offset table mapping from byte offset to line and column in the generated text. R=titzer@chromium.org, ahaas@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2050213002 Cr-Commit-Position: refs/heads/master@{#37026} [modify] https://crrev.com/12aa132d873da628971f0610a987bcef302d9d9f/src/compiler/wasm-compiler.cc [modify] https://crrev.com/12aa132d873da628971f0610a987bcef302d9d9f/src/ostreams.cc [modify] https://crrev.com/12aa132d873da628971f0610a987bcef302d9d9f/src/ostreams.h [modify] https://crrev.com/12aa132d873da628971f0610a987bcef302d9d9f/src/wasm/ast-decoder.cc [modify] https://crrev.com/12aa132d873da628971f0610a987bcef302d9d9f/src/wasm/ast-decoder.h
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/175fc180b717dcac0301b7300eb9ccfa790540f4 commit 175fc180b717dcac0301b7300eb9ccfa790540f4 Author: clemensh <clemensh@chromium.org> Date: Thu Jun 16 08:45:19 2016 [wasm] Add functionality to decode a function offset table This will be needed during debugging to know function boundaries within the wasm module bytes, and to extract the bytes for a single function to disassemble it. R=titzer@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2055783002 Cr-Commit-Position: refs/heads/master@{#37028} [modify] https://crrev.com/175fc180b717dcac0301b7300eb9ccfa790540f4/src/wasm/decoder.h [modify] https://crrev.com/175fc180b717dcac0301b7300eb9ccfa790540f4/src/wasm/module-decoder.cc [modify] https://crrev.com/175fc180b717dcac0301b7300eb9ccfa790540f4/src/wasm/module-decoder.h [modify] https://crrev.com/175fc180b717dcac0301b7300eb9ccfa790540f4/src/wasm/wasm-module.h [modify] https://crrev.com/175fc180b717dcac0301b7300eb9ccfa790540f4/src/wasm/wasm-result.h
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/b16d51efa9111564d7e274376a8839d1886019ec commit b16d51efa9111564d7e274376a8839d1886019ec Author: clemensh <clemensh@chromium.org> Date: Thu Jun 16 12:04:57 2016 [wasm] Make reported "column number" 1-based We report the byte offset as column number, but devtools assumes them to be 1-based and subtracts one unconditionally before further processing it. It's a bit unfortunate, but because of that we have to just add 1 to the reported column number on the public StackTrace API. R=ahaas@chromium.org, titzer@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2071563002 Cr-Commit-Position: refs/heads/master@{#37036} [modify] https://crrev.com/b16d51efa9111564d7e274376a8839d1886019ec/src/isolate.cc [modify] https://crrev.com/b16d51efa9111564d7e274376a8839d1886019ec/src/runtime/runtime-internal.cc [modify] https://crrev.com/b16d51efa9111564d7e274376a8839d1886019ec/test/cctest/wasm/test-wasm-stack.cc [modify] https://crrev.com/b16d51efa9111564d7e274376a8839d1886019ec/test/cctest/wasm/test-wasm-trap-position.cc
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/b8238f897746479a2dca4d42e75d2f96791cbbbf commit b8238f897746479a2dca4d42e75d2f96791cbbbf Author: clemensh <clemensh@chromium.org> Date: Fri Jun 17 08:33:36 2016 [wasm] Split off debug info from wasm object All debugging-related information is now stored inside a dedicated object, which is only allocated if debugging support is needed. This is also where later a reference to the interpreter will be stored for executing to-be-debugged functions and providing stack inspection. R=titzer@chromium.org, ahaas@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2050953003 Cr-Commit-Position: refs/heads/master@{#37055} [modify] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/BUILD.gn [modify] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/runtime/runtime-internal.cc [modify] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/v8.gyp [add] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/wasm/wasm-debug.cc [add] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/wasm/wasm-debug.h [modify] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/wasm/wasm-module.cc [modify] https://crrev.com/b8238f897746479a2dca4d42e75d2f96791cbbbf/src/wasm/wasm-module.h
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/48a96d172010e5fc55a0a614ba53054a7ce544aa commit 48a96d172010e5fc55a0a614ba53054a7ce544aa Author: clemensh <clemensh@chromium.org> Date: Mon Jun 20 11:05:35 2016 [wasm] Handlify WasmDebugInfo where needed All function which potentially do heap allocations now take a Handle on a WasmDebugInfo. This unfortunately requires to make some function static, since otherwise the "this" pointer would not be handlified. R=ahaas@chromium.org, titzer@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2074933005 Cr-Commit-Position: refs/heads/master@{#37099} [modify] https://crrev.com/48a96d172010e5fc55a0a614ba53054a7ce544aa/src/wasm/wasm-debug.cc [modify] https://crrev.com/48a96d172010e5fc55a0a614ba53054a7ce544aa/src/wasm/wasm-debug.h
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/d249efd705cd851e8441ee3cc804669812ba1694 commit d249efd705cd851e8441ee3cc804669812ba1694 Author: titzer <titzer@chromium.org> Date: Thu Jun 30 09:54:39 2016 [wasm] Disassemble wasm code from script This stores the wasm object and the function index in the script, and adds functions to get the disassembled wasm code as well as the offset table mapping from byte position to line and column in the disassembly solely from the script. This will be used to show "ui source code" in DevTools, and map raw locations from the stack trace into this code view. R=yangguo@chromium.org, ahaas@chromium.org, titzer@chromium.org BUG= chromium:613110 patch from issue 2063013004 at patchset 80001 (http://crrev.com/2063013004#ps80001) Review-Url: https://codereview.chromium.org/2105303002 Cr-Commit-Position: refs/heads/master@{#37430} [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/debug/debug.js [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/objects-inl.h [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/objects.h [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/runtime/runtime-debug.cc [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/runtime/runtime.h [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/wasm/ast-decoder.cc [modify] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/src/wasm/wasm-debug.cc [add] https://crrev.com/d249efd705cd851e8441ee3cc804669812ba1694/test/mjsunit/wasm/debug-disassembly.js
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/5b6e39135442f3bd3e19c91d8645533e4e9976ac commit 5b6e39135442f3bd3e19c91d8645533e4e9976ac Author: clemensh <clemensh@chromium.org> Date: Tue Oct 18 09:58:20 2016 [wasm] Add inspector test for stack traces This ensures that the stack traces show up correctly in DevTools. I will later extend it for source view. R=kozyatinskiy@chromium.org, yangguo@chromium.org, titzer@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2420093002 Cr-Commit-Position: refs/heads/master@{#40392} [add] https://crrev.com/5b6e39135442f3bd3e19c91d8645533e4e9976ac/test/inspector/debugger/wasm-stack-expected.txt [add] https://crrev.com/5b6e39135442f3bd3e19c91d8645533e4e9976ac/test/inspector/debugger/wasm-stack.js [modify] https://crrev.com/5b6e39135442f3bd3e19c91d8645533e4e9976ac/test/inspector/inspector-test.cc
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/de52d865a0ca21ce1d140eef8dad53b129ce89d2 commit de52d865a0ca21ce1d140eef8dad53b129ce89d2 Author: clemensh <clemensh@chromium.org> Date: Tue Nov 22 17:16:03 2016 [wasm] Move and refactor position to location translation The GetPositionInfo function only operates on WasmCompiledModule, so it should be a method of that class. This CL also splits the method in two, such that I can reuse the GetContainingFunction method for breakpoint support. R=titzer@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2521293002 Cr-Commit-Position: refs/heads/master@{#41191} [modify] https://crrev.com/de52d865a0ca21ce1d140eef8dad53b129ce89d2/src/objects.cc [modify] https://crrev.com/de52d865a0ca21ce1d140eef8dad53b129ce89d2/src/wasm/wasm-module.cc [modify] https://crrev.com/de52d865a0ca21ce1d140eef8dad53b129ce89d2/src/wasm/wasm-module.h [modify] https://crrev.com/de52d865a0ca21ce1d140eef8dad53b129ce89d2/src/wasm/wasm-objects.cc [modify] https://crrev.com/de52d865a0ca21ce1d140eef8dad53b129ce89d2/src/wasm/wasm-objects.h
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/12cdb31b2fd1a51843e0b4753af15e4488a67a3e commit 12cdb31b2fd1a51843e0b4753af15e4488a67a3e Author: clemensh <clemensh@chromium.org> Date: Tue Dec 06 13:20:07 2016 [inspector] Introduce debug::WasmScript *and* report all "virtual" wasm scripts right when the wasm script is registered at the inspector. WasmScript is a subtype of Script, with the cast checking that it is actually a wasm script. This layout makes it quite easy to implement functionality that is only available for wasm scripts, and allows to later directly use the WasmCompiledModule instead of the i::Script for backing the debug::WasmScript. We might also add virtual methods to provide different implementations for GetSourcePosition, Source and others. DisassembleWasmFunction now also becomes a method of this class instead of a static function on the DebugInterface. The WasmTranslation now uses the new WasmScript type instead of the Script wrapper, and also registers all virtual wasm scripts immediately when the wasm script is made public to the inspector (when the wasm module is created). R=yangguo@chromium.org,dgozman@chromium.org,titzer@chromium.org BUG= chromium:613110 , chromium:659715 Review-Url: https://codereview.chromium.org/2531163010 Cr-Commit-Position: refs/heads/master@{#41519} [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/api.cc [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/debug/debug-interface.h [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/inspector/v8-debugger-agent-impl.cc [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/inspector/v8-debugger.cc [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/inspector/v8-stack-trace-impl.cc [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/inspector/wasm-translation.cc [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/src/inspector/wasm-translation.h [add] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/test/inspector/debugger/wasm-scripts-expected.txt [add] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/test/inspector/debugger/wasm-scripts.js [modify] https://crrev.com/12cdb31b2fd1a51843e0b4753af15e4488a67a3e/test/inspector/protocol-test.js
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/a9017cb0184ec5f1f42b74e26aa1055b9ea6633b commit a9017cb0184ec5f1f42b74e26aa1055b9ea6633b Author: clemensh <clemensh@chromium.org> Date: Tue Dec 06 14:26:15 2016 [inspector] Split V8DebuggerScript implementation for wasm Make some methods on V8DebuggerScript virtual and provide the implementations ActualScript for scripts which are backed by scripts on V8's side, and WasmVirtualScript for wasm scripts. The added test case ensures that we at least don't crash on the attempt to get breakable locations for wasm "scripts", which we did previously. Returning a reasonable result for wasm will be implemented in a follow-up commit. R=yangguo@chromium.org, jgruber@chromium.org BUG=chromium:667767, chromium:613110 Review-Url: https://codereview.chromium.org/2532433003 Cr-Commit-Position: refs/heads/master@{#41527} [modify] https://crrev.com/a9017cb0184ec5f1f42b74e26aa1055b9ea6633b/src/inspector/v8-debugger-script.cc [modify] https://crrev.com/a9017cb0184ec5f1f42b74e26aa1055b9ea6633b/src/inspector/v8-debugger-script.h [modify] https://crrev.com/a9017cb0184ec5f1f42b74e26aa1055b9ea6633b/src/inspector/v8-debugger.cc [modify] https://crrev.com/a9017cb0184ec5f1f42b74e26aa1055b9ea6633b/src/inspector/wasm-translation.cc
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/222541dff51aba0623edc98bbecb6e1a35d22063 commit 222541dff51aba0623edc98bbecb6e1a35d22063 Author: clemensh <clemensh@chromium.org> Date: Mon Dec 12 12:45:49 2016 [wasm] Generate correct locations for error messages The current logic in Isolate::GetLocationFromStackTrace just ignores wasm frames, making the computed location point to the first javascript frame, like this: test.js:17: RuntimeError: divide by zero module.exports.main(); ^ RuntimeError: divide by zero at main (<WASM>[1]+5) at test.js:17:16 This CL not only fixes the location to point to the top-most wasm frame, but also exposes to the embedder that the script of that location is a wasm script, allowing for custom printing of wasm locations. The Shell::ReportException method now checks for this flag, and prints wasm locations like this: <WASM>[0]+5: RuntimeError: divide by zero RuntimeError: divide by zero at main (<WASM>[0]+5) at test/message/wasm-trap.js:15:16 R=titzer@chromium.org, yangguo@chromium.org BUG= chromium:613110 Review-Url: https://codereview.chromium.org/2563673002 Cr-Commit-Position: refs/heads/master@{#41640} [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/include/v8.h [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/src/api.cc [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/src/d8.cc [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/src/d8.h [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/src/isolate.cc [modify] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/src/messages.cc [add] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/test/message/wasm-trap.js [add] https://crrev.com/222541dff51aba0623edc98bbecb6e1a35d22063/test/message/wasm-trap.out
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/1fef739ab072b9262d83b50c8fec9f4b1409e099 commit 1fef739ab072b9262d83b50c8fec9f4b1409e099 Author: clemensh <clemensh@chromium.org> Date: Mon Dec 19 17:22:55 2016 [wasm] Implement GetPossibleBreakpoints This CL implements GetPossibleBreakpoints for wasm, by iterating over all functions in the requested range and returning the location of all instructions within that range. The connection to the inspector will be added later, when setting breakpoint also works for wasm: http://crrev.com/2536763002 BUG= chromium:613110 R=titzer@chromium.org Review-Url: https://codereview.chromium.org/2588763002 Cr-Commit-Position: refs/heads/master@{#41818} [modify] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/src/wasm/wasm-objects.cc [modify] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/src/wasm/wasm-objects.h [modify] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/test/cctest/BUILD.gn [modify] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/test/cctest/cctest.gyp [add] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/test/cctest/wasm/test-wasm-breakpoints.cc [modify] https://crrev.com/1fef739ab072b9262d83b50c8fec9f4b1409e099/test/cctest/wasm/wasm-run-utils.h
could you share "https://docs.google.com/a/chromium.org/document/d/1u24T3QvUrUfakdtorIPvqc11IRMKQ1OI-d2J8mPo0mE/edit?usp=sharing" to public ? thx!
The document is already quite outdated. See v8 bug 5822 for current status and recent changes. https://bugs.chromium.org/p/v8/issues/detail?id=5822
A lot of work completed under this bug, new work would require new bugs!
Comment 1 by bugdroid1@chromium.org
, Jun 16 2016