Replies: 1 comment
-
Thanks for writing this up! I think there should be more, better, better structured docs for trunk. And I personally think that the homepage approach no longer scales. It's good for a simple: getting started approach, but there could be more. That's why I started working on a "guide" approach. And I think what you wrote up would be a perfect candidate for that. You can see the current version here: https://trunkrs.dev/guide/ … and the source for that here: https://github.com/trunk-rs/trunk/tree/main/guide I would love to get some more feedback on the approach, before fully committing to it. However, I also don't see much alternatives (other than different tooling). However, I think having your findings documented in that guide, actually provide one more reason to go into that direction. And as so far I didn't get any negative feedback, I would encourage you to start a section in that book related to "debugging". That would be super valuable IMHO. |
Beta Was this translation helpful? Give feedback.
-
I was a little frustrated with getting useful debug information in my browser (Arc, Chrome-based) for my wasm app, and took an afternoon to figure something out. This here has worked for me: I get breakpoints, source location, really workable debugging. The info about Source Maps on the Yew page isn't super up to date anymore (the rust WASM working group has stopped updating their book 5 years ago, and in the meantime DWARF has gained quite some nice support).
So here's what I ended up doing (in Chrome):
data-keep-debug="true"
in your app's index.html. I have other directives in there (to disable optimization, for one), but this is the major one that adds DWARF debuginfo to the WASM file that your browser sees. You can check that by copying the link and using wasm-tools' objdump (see below).[C/C++ DevTools Support (DWARF)] Loaded debug symbols for http://[...]/_bg.wasm, found 912 source file(s)
appears in the console, you're in business.I'd love to get this into docs somewhere, ideally in Trunk itself.
Also, it appears that the "rust" asset docs about
data-keep-debug
are a bit misleading. That it says "...even in release mode" made me think that debug info would be included in a dev build - that is not so! You must manually enable this setting, otherwise even a dev build won't have the information.Hope this will be helpful for others,
Checking that your .wasm file contains DWARF debuginfo
I'm using wasm-tools for that:
console session with my copy-pasted _bg.wasm source file
You're looking for the
custom ".debug_
sections; if these are present (and probably large), your app has debug info.Beta Was this translation helpful? Give feedback.
All reactions