-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--profiling doesn't preserve function names #797
Comments
For others struggling with this like me, I've been able to work around this by setting the [package.metadata.wasm-pack.profile.release]
# previously had just ['-O4']
wasm-opt = ['-O4', '-g'] Which I got from this doc: https://rustwasm.github.io/docs/wasm-pack/cargo-toml-configuration.html |
@stefan2718 Oh yeah, sorry, should've probably mentioned this as a workaround. I'm using the same one, except with |
@RReverser Do I need to be building with nightly to use the |
@stefan2718 No, it works for me as-is. But note that my original issue is about preserving names (in the "names" subsection), while you seem to be talking about DWARF debuginfo instead? That one is controlled by separate flags, and doesn't work with wasm-bindgen for different reasons. |
AIUI this doesn't work for crates within a workspace:
|
Work around from rustwasm/wasm-pack#797
🐛 Bug description
profiling
mode is essentially equivalent torelease
and doesn't preserve debug info as documented (not even function names necessary for profiling or basic debugging).🤔 Expected Behavior
The generated
.wasm
contains a custom"names"
section that is subsequently used by engines for function names in error stacks and profiling traces.👟 Steps to reproduce
Compile any package with
wasm-pack --profiling
.Run an example app in a browser profiler or a debugger and observe that all functions are shown as just
wasm-function[...]
, just like in a release mode.Alternatively, check the generated
.wasm
withwasm-objdump -h
for presence of"names"
section (it's absent).🌍 Your environment
Include the relevant details of your environment.
wasm-pack version: 0.9.1
rustc version: 1.41.0
Extra info
This seems to be caused by
wasm-pack
runningwasm-opt
without a-g
flag, which is necessary to preserve function names information.The text was updated successfully, but these errors were encountered: