Skip to content

Conversation

@pelletier
Copy link
Contributor

Regression from #46. By turning this error into a warning, we allow wzprof to be used on modules that don't have DWARF, such as those produced by golang/go, and still provide meaningful results (though laking line-level profiles, and source code display).

cc @codefromthecrypt

Regression from #46. By turning this error into a warning, we allow wzprof to be
used on modules that don't have DWARF, such as those produced by golang/go.
@pelletier pelletier requested review from Pryz and achille-roussel May 18, 2023 21:14
symbols, err := wzprof.BuildDwarfSymbolizer(compiledModule)
if err != nil {
return fmt.Errorf("symbolizing wasm module: %w", err)
symbols = nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to crash when we generate the profile if the symbolizer is nil?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind we have a check there https://github.com/stealthrocket/wzprof/blob/main/wzprof.go#L83-L86

What do you think about removing the nil check an instead using a no-op implementation of the interface? nil as a valid value seems like asking for trouble.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I thought about it, but figured I'll revamp all this when I'll add pclntab support and need to do some kind of symbolizer selection.

@codefromthecrypt
Copy link

Looks good. It might be better to say "dwarf not available" instead of the first warning, but hey, it works!

$ GOOS=wasip1 GOARCH=wasm gotip build -o math.wasm math.go
$ wzprof -sample 1 -memprofile /tmp/profile math.wasm
2023/05/19 07:02:02 warning: symbolizing wasm module: dwarf: decoding dwarf section info at offset 0x0: too short
3
$ go tool pprof -http :4000 /tmp/profile
Screenshot 2023-05-19 at 07 03 23

@pelletier pelletier merged commit bfc5e90 into main May 19, 2023
@pelletier pelletier deleted the allow-dwarf branch May 19, 2023 12:56
@pelletier pelletier added the bug Something isn't working label May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants