Heya! - I was chatting with the author of Wasmphobia (@Surma) about adding Component support to their wasmphobia
project (wasm binary -> code size flame graph tool), and we noticed that several sections don't seem to carry any DWARF information.
Some of that is expected and can probably be resolved - but maybe 1/3 of the @section: code
seems to not have any information, and that doesn't seem right?
Surma specifically asked the following:
I was under the impression that — even in the component model — all code from all modules would be in the
code
section. So I’d expect that DWARF debugging data would provide correct attributions. Am I wrong?
I don't know whether this is expected, a limitation of Wasm Components, of our current tooling, or perhaps a bug in wasmphobia. I figured this would be the right place to ask people who are more clued in than I am. Any help here would be appreciated!
wasm-tools (or the language equivalent) doesn't inject the dwarf properly yet.
I had been chatting with @Till Schneidereit about this at wasmio and @fitzgen (he/him) prior to wasmio, and we had a few steps that we need to take.
among them that llvm-dwarfdump doesn't understand the component file format yet, for example.
ahhh, ok! thank you!
So I thought https://github.com/rustwasm/wasm-bindgen/issues/2389 was the issue tracking that, and since it had been closed all known issues had been resolved
I didn't realized there was outstanding work here
Are there any open issues about this I could link to?
wasm-bindgen works FINE
wasi 1.0 (which is just wasm core with structure!) works fine with mild exceptions like not enough type information because the wasm compilers are trying to optimize out code steps.
I was able to get components to retain dwarf info, but I couldn't find a debugger to pick it up at all, so I'm entirely unsurprised here
it had been my intention to work with Nick to figure out which steps hit the biggest bang for the buck here, or whether we might parallelize our work. His presentation on work needed was here: https://github.com/bytecodealliance/rfcs/pull/34
So if you wanna have fun, and I know you do, try using a wasi preview 1 module with dwarf in wasmphobia and I would expect it to work!!!
but components, NOPE, not yet
ok ok ok, so what I'm hearing is that this is an LLVM / Rust Toolchain issue more than anything else?
BTW, using flamegraphs with dwarf info would be the BOMB and I'll help doing anything to make that begin working
@Ralph fwiw wasmphobia
already supports components now! - this is just about making that better
filling out the final missing sections
Yoshua Wuyts said:
ok ok ok, so what I'm hearing is that this is an LLVM / Rust Toolchain issue more than anything else?
for the original dwarf insertion, but ALSO the compilation step needs to be able to NOT optimize away tons of code
Yoshua Wuyts said:
Ralph fwiw
wasmphobia
already supports components now! - this is just about making that better
WAIT WUT
WAIT WUT
Yoshua Wuyts said:
Some of that is expected and can probably be resolved - but maybe 1/3 of the
@section: code
seems to not have any information, and that doesn't seem right?
hehehe yeah this right here
this is my wasm-http-tools
concurrent HTTP client example
surma got it working yesterday
that is EITHER an insertion bug OR a wasmtools bug/compile opt
Yoshua Wuyts said:
surma got it working yesterday
who is this Surma person and how do we get them more donuts?
Does Surma have a gofundme for donuts?
_gets out wallet_
haha, yeah Surma is great
Reading over the component support I think that there may need to be a bit more refactoring to support components. Right now it's slurping all dwarf sections into one object when each core wasm module will need to be treated separately. I'm not sure if that'd explain the current thing you're seeing though, it depends on the size of the component. Additionally though there's going to be multiple code sections within a component so it'd be good to confirm that the dwarf info is relative to the right code section start.
Additionally though I see that the "component-type" custom section is in the component that has a flame graph, but that should be stripped out by wit-component when a component is created, so that's also suspect (but perhaps just a bug in wit-component?)
right. So some sorting out of these things is necessary.
following up! finally. https://hachyderm.io/deck/tags/webassembly shows that you can do this now with a component using wasmtime serve
in v23.1
look at all those handles!!!
You probably meant to link https://hachyderm.io/@squillace/112989210932769282
Dammit
Yes
Thank you, @bjorn3
Last updated: Nov 22 2024 at 16:03 UTC