-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: add string constants to DWARF #67744
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
Comments
I think this had been discussed somewhere in another issue, but I can't find it, so I'll restate it: when I did the thing that exports integers to dwarf I didn't include string constants because I thought it would bloat too much the executable size. |
I found your message about the binary size here: https://go-review.googlesource.com/c/go/+/61019 (comment Patchset 5 | Sep 08, 2017 10:01 PM ). |
It is compressed but it doesn't change my opinion on the matter: integer constants are useful because we can use them to the value of variables, which would otherwise be very opaque. The same does not go for string constants. But keep in mind that this is just my opinion. |
CC @golang/compiler |
I'm working on go-size-analyzer and try to extract some info from dwarf. I also met this problem. Sometimes constant string can be very large if the programmer use the tool like bindata. But the info of this part was ommitted from dwarf. |
Storing the full const string would lead to excessive size, maybe we could store the offset in const against |
Change https://go.dev/cl/604101 mentions this issue: |
Go version
go version go1.22.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I tried to view the value of different types of const values with dlv.
Code:
What did you see happen?
I obtain a different behavior depending of the type of the constant.
Debug:
Analyze:
By analyzing Go ompiler code, we can see into src/cmd/compile/internal/gc/obj.go:163 that's the func dumpGlobalConst exports only integer const "for now" (ie. comment line 172).
What did you expect to see?
I expect to see all const values.
Debug:
Analyze:
The text was updated successfully, but these errors were encountered: