Skip to content

Commit 8b46e73

Browse files
deploy: e8cc6dd
1 parent 2a090e6 commit 8b46e73

File tree

5 files changed

+42
-6
lines changed

5 files changed

+42
-6
lines changed
382 KB
Loading

getting-started/debugging.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ <h1><a class="header" href="#debugging" id="debugging">Debugging</a></h1>
166166
If you are using <code>swift build</code>, it is enabled by default.</p>
167167
<h2><a class="header" href="#chrome-devtools" id="chrome-devtools">Chrome DevTools</a></h2>
168168
<p>When you are debugging a web browser application, Chrome DevTools is a good tool to use. It allows you to
169-
put breakpoints, step through at Swift source code level.</p>
169+
put breakpoints and step through at Swift source code level.</p>
170+
<h3><a class="header" href="#official-dwarf-extension" id="official-dwarf-extension">Official DWARF Extension</a></h3>
170171
<p>Please follow the steps below to configure Chrome DevTools for SwiftWasm:</p>
171172
<ol>
172173
<li>Install <a href="https://goo.gle/wasm-debugging-extension"><code>C/C++ DevTools Support (DWARF)</code></a> extension in your Chrome</li>
@@ -175,7 +176,24 @@ <h2><a class="header" href="#chrome-devtools" id="chrome-devtools">Chrome DevToo
175176
<p>See <a href="https://developer.chrome.com/blog/wasm-debugging-2020">the DevTools team's official introduction</a> for more details about the extension.</p>
176177
<p><img src="./chrome-devtools.png" alt="" /></p>
177178
<p>Note that the function names in the stack trace are mangled. You can demangle them using <code>swift demangle</code> command.</p>
178-
<p>Unfortunately, variable inspection is unavailable since Swift depends on its own mechanisms to do that instead of DWARF's structure type feature. (See <a href="https://github.com/swiftwasm/swift/issues/593">this thread</a> for more details)</p>
179+
<p>Unfortunately, variable inspection is unavailable since Swift depends on its own mechanisms to do that instead of DWARF's structure type feature. If you need this feature, you can use the enhanced extension below.</p>
180+
<h3><a class="header" href="#enhanced-dwarf-extension-for-swift" id="enhanced-dwarf-extension-for-swift">Enhanced DWARF Extension for Swift</a></h3>
181+
<p>For a better Swift debugging experience, there's also an enhanced version of the DWARF extension specifically for Swift. This extension enables:</p>
182+
<ul>
183+
<li>Breakpoint setting and Swift code inspection</li>
184+
<li>Human-readable call stack frames</li>
185+
<li>Swift variable value inspection</li>
186+
</ul>
187+
<p>To install this enhanced extension:</p>
188+
<ol>
189+
<li>First, uninstall the official &quot;C/C++ DevTools Support (DWARF)&quot; extension if you have it installed</li>
190+
<li>Download the extension ZIP file from <a href="https://github.com/GoodNotes/devtools-frontend/releases/tag/swift-0.2.3.0">GitHub Releases</a></li>
191+
<li>Go to <code>chrome://extensions/</code> and enable &quot;Developer mode&quot;</li>
192+
<li>Drag and drop the downloaded ZIP file into the page</li>
193+
</ol>
194+
<p>When you close and reopen the DevTools window, DevTools will suggest reloading itself to apply settings.</p>
195+
<p>Note: There is a known issue where some JavaScriptKit types like <code>JSObject</code> and <code>JSValue</code> are not shown in pretty format in the variables view.</p>
196+
<p><img src="./chrome-devtools-swift.png" alt="" /></p>
179197
<h2><a class="header" href="#a-hrefhttpsgithubcomkateinoigakukunwasminspectwasminspecta" id="a-hrefhttpsgithubcomkateinoigakukunwasminspectwasminspecta"><a href="https://github.com/kateinoigakukun/wasminspect">wasminspect</a></a></h2>
180198
<p><a href="https://github.com/kateinoigakukun/wasminspect">wasminspect</a>
181199
can help in the investigation if the debugged binary does not rely on integration with JavaScript.

print.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ <h1><a class="header" href="#debugging" id="debugging">Debugging</a></h1>
761761
If you are using <code>swift build</code>, it is enabled by default.</p>
762762
<h2><a class="header" href="#chrome-devtools" id="chrome-devtools">Chrome DevTools</a></h2>
763763
<p>When you are debugging a web browser application, Chrome DevTools is a good tool to use. It allows you to
764-
put breakpoints, step through at Swift source code level.</p>
764+
put breakpoints and step through at Swift source code level.</p>
765+
<h3><a class="header" href="#official-dwarf-extension" id="official-dwarf-extension">Official DWARF Extension</a></h3>
765766
<p>Please follow the steps below to configure Chrome DevTools for SwiftWasm:</p>
766767
<ol>
767768
<li>Install <a href="https://goo.gle/wasm-debugging-extension"><code>C/C++ DevTools Support (DWARF)</code></a> extension in your Chrome</li>
@@ -770,7 +771,24 @@ <h2><a class="header" href="#chrome-devtools" id="chrome-devtools">Chrome DevToo
770771
<p>See <a href="https://developer.chrome.com/blog/wasm-debugging-2020">the DevTools team's official introduction</a> for more details about the extension.</p>
771772
<p><img src="getting-started/./chrome-devtools.png" alt="" /></p>
772773
<p>Note that the function names in the stack trace are mangled. You can demangle them using <code>swift demangle</code> command.</p>
773-
<p>Unfortunately, variable inspection is unavailable since Swift depends on its own mechanisms to do that instead of DWARF's structure type feature. (See <a href="https://github.com/swiftwasm/swift/issues/593">this thread</a> for more details)</p>
774+
<p>Unfortunately, variable inspection is unavailable since Swift depends on its own mechanisms to do that instead of DWARF's structure type feature. If you need this feature, you can use the enhanced extension below.</p>
775+
<h3><a class="header" href="#enhanced-dwarf-extension-for-swift" id="enhanced-dwarf-extension-for-swift">Enhanced DWARF Extension for Swift</a></h3>
776+
<p>For a better Swift debugging experience, there's also an enhanced version of the DWARF extension specifically for Swift. This extension enables:</p>
777+
<ul>
778+
<li>Breakpoint setting and Swift code inspection</li>
779+
<li>Human-readable call stack frames</li>
780+
<li>Swift variable value inspection</li>
781+
</ul>
782+
<p>To install this enhanced extension:</p>
783+
<ol>
784+
<li>First, uninstall the official &quot;C/C++ DevTools Support (DWARF)&quot; extension if you have it installed</li>
785+
<li>Download the extension ZIP file from <a href="https://github.com/GoodNotes/devtools-frontend/releases/tag/swift-0.2.3.0">GitHub Releases</a></li>
786+
<li>Go to <code>chrome://extensions/</code> and enable &quot;Developer mode&quot;</li>
787+
<li>Drag and drop the downloaded ZIP file into the page</li>
788+
</ol>
789+
<p>When you close and reopen the DevTools window, DevTools will suggest reloading itself to apply settings.</p>
790+
<p>Note: There is a known issue where some JavaScriptKit types like <code>JSObject</code> and <code>JSValue</code> are not shown in pretty format in the variables view.</p>
791+
<p><img src="getting-started/./chrome-devtools-swift.png" alt="" /></p>
774792
<h2><a class="header" href="#a-hrefhttpsgithubcomkateinoigakukunwasminspectwasminspecta" id="a-hrefhttpsgithubcomkateinoigakukunwasminspectwasminspecta"><a href="https://github.com/kateinoigakukun/wasminspect">wasminspect</a></a></h2>
775793
<p><a href="https://github.com/kateinoigakukun/wasminspect">wasminspect</a>
776794
can help in the investigation if the debugged binary does not rely on integration with JavaScript.

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)