Skip to content

Remove flag that strips dwarf symbols #2542

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

Closed

Conversation

yzhao1012
Copy link

Dwarf symbols are used by debugging tools to get the layout of the data structure, and many other runtime information.
For example gdb needs the calling convention information to figure out how to invoke a function.

The increase in executable size is high though, current size of the dwarf symbols built from the mainline is ~3MB.
Or the executable file built with go build is ~15MB, and go build -ldflags "-w" is ~12MB.

Let me know if this is acceptable.

@kozlovic
Copy link
Member

@yzhao1012 As you know we already not stripping symbols anymore (since you are the one that submitted PR earlier). I don't think having the dwarf symbols in a release product is necessary. It is unlikely that one will do a "gdb" session on a live production server. The product is open-sourced and anyone can build it the way they want. If some users have the need to debug the server, they can build a version without the "-w" flag.

@bruth bruth closed this Apr 23, 2023
@wallyqs wallyqs reopened this Nov 7, 2023
@wallyqs wallyqs requested a review from a team as a code owner November 7, 2023 22:41
@alexbozhenko
Copy link
Contributor

Go's own doc on gdb says :

Note that Delve is a better alternative to GDB when debugging Go programs built with the standard toolchain. It understands the Go runtime, data structures, and expressions better than GDB. Delve currently supports Linux, OSX, and Windows on amd64. For the most up-to-date list of supported platforms, please see the Delve documentation.

But Delve too complains about missing debug symbols:

go install github.com/go-delve/delve/cmd/dlv@latest
# dlv attach $(pidof nats-server)
Warning: no debug info found, some functionality will be missing such as stack traces and variable evaluation.
Type 'help' for list of commands.

Currently, the difference between the binary -w flag is 15MB, and without the flag: 20MB

@alexbozhenko
Copy link
Contributor

related discussion: golang/go#26074

@neilalexander
Copy link
Member

At the moment I would prefer to keep flags as-is, production systems won't be running under delve and development systems can build from source if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants