I compiled a rust program cargo build --target wasm32-wasi
, I guess that exported functions can be mapped back to rust ones, but is there a way to map non-exported ones? (This is so I can find the rust code that generates some big wasm/clif)
@Joey Gouly you mean like exploring a wasm module via the wasmtime API, or just figuring info about the wasm itself?
@Alex Crichton the latter. I found a function that takes a long time to compile, and want to figure out the rust code it came from
hm wanna gist the wasm module?
and/or do you have the rust source to poke around?
oh one other thing you may be able to do is to use llvm-dwarfdump somehow
I know nothing about dwarfdump but there's presumably filename/location information in there somewhere
esp for a debug build
I guess the problem with a debug build is that it might not match up to the release one
but rust has debug info by default, so I'll give it a try
release builds can still have DWARF info
name section normally contains rust names for every function
Oh, and I guess wasm2wat uses that? I just tried wasm2wat and see the names
@Joey Gouly cranelift has ability to read name section -- maybe there is a way to plug that into clif or just instrument code in some other way
@Yury Delendik in cranelift/src/wasm.rs
line ~175, would be a good place to print it. have you got some pointers on how to do that?
@Joey Gouly is DummyEnvironment
used by that? it needs to implement declare_func_name
https://github.com/bytecodealliance/wasmtime/blob/8597930eed2e5e92c78ec4cb6d6b39d80c5ea220/cranelift/wasm/src/sections_translator.rs#L429
thanks, it does implement that! I'll try print from that then
Last updated: Nov 22 2024 at 17:03 UTC