Navigation Menu

Skip to content
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

cmd/compile: export non-integer constants to debug info #35527

Open
dlsniper opened this issue Nov 12, 2019 · 11 comments
Open

cmd/compile: export non-integer constants to debug info #35527

dlsniper opened this issue Nov 12, 2019 · 11 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Debugging NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dlsniper
Copy link
Contributor

What version of Go are you using (go version)?

go1.13.4

Does this issue reproduce with the latest release?

I haven't tried with Go 1.14 yet

What operating system and processor architecture are you using (go env)?

windows/amd64

What did you do?

ot == AnotherConst

What did you expect to see?

A boolean result

What did you see instead?

could not find symbol value for AnotherConst
@aarzilli
Copy link
Contributor

aarzilli commented Nov 12, 2019

Non-integer constants are never exported to debug_info, it doesn't have anything to do with whether they are inlined or not. Also, I'm not sure it's worth the executable bloat costs, since IIRC there was no way to reuse the strings stored in rodata from the debug_info constant entries.

@gopherbot please add label Debugging

@dlsniper
Copy link
Contributor Author

Thanks for the explanation.

The problem was reported to GoLand by a user that had a similar code like the one above.
It's rather common to run a compare operation like this. For example, I use this to setup conditional breakpoints. Also, not everyone will know ahead of time that one is a constant or not when making the comparison, nor suggesting to change the code would be possible.

I'm not sure if go-delve/delve#1753 is related or not.

@andybons
Copy link
Member

@aclements

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 12, 2019
@andybons andybons added this to the Unplanned milestone Nov 12, 2019
@kzhui125
Copy link

kzhui125 commented May 7, 2020

When I debug this code:

https://github.com/adonovan/gopl.io/blob/65c318dde95e3b46a0add461ccf681bd5345b67c/ch1/lissajous/main.go#L69

and hover at the constant variables, the value doesn't appear.

I have to find the definitions what exactly the value is.

@aarzilli
Copy link
Contributor

aarzilli commented May 8, 2020

@kzhui125 that doesn't have anything to do with this issue and should be reported to GoLand.

@kzhui125
Copy link

kzhui125 commented May 8, 2020

I am using VSCode, I have reported this issue in vscode-go extension. I was told this is upstream issue. @aarzilli

microsoft/vscode-go#3226

@aarzilli
Copy link
Contributor

aarzilli commented May 8, 2020

You're right, I was confusing this with a different issue.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@x-yuri
Copy link

x-yuri commented Dec 30, 2023

I wonder if that's the issue I'm experiencing...

$ git clone https://github.com/docker/compose
$ cd compose
$ dlv debug github.com/docker/compose/v2/cmd -- up
Type 'help' for list of commands.
(dlv) b /home/yuri/go/pkg/mod/github.com/compose-spec/compose-go/v2@v2.0.0-beta.2/cli/options.go:260
Breakpoint 1 set at 0x199cc8e for github.com/compose-spec/compose-go/v2/cli.WithEnvFiles.func1() /home/yuri/go/pkg/mod/github.com/compose-spec/compose-go/v2@v2.0.0-beta.2/cli/options.go:260
(dlv) c
> github.com/compose-spec/compose-go/v2/cli.WithEnvFiles.func1() /home/yuri/go/pkg/mod/github.com/compose-spec/compose-go/v2@v2.0.0-beta.2/cli/options.go:260 (hits goroutine(1):1 total:1) (PC: 0x199cc8e)
   255:         return func(o *ProjectOptions) error {
   256:                 if len(file) > 0 {
   257:                         o.EnvFiles = file
   258:                         return nil
   259:                 }
=> 260:                 if v, ok := os.LookupEnv(consts.ComposeDisableDefaultEnvFile); ok {
   261:                         b, err := strconv.ParseBool(v)
   262:                         if err != nil {
   263:                                 return err
   264:                         }
   265:                         if b {
(dlv) p consts.ComposeDisableDefaultEnvFile
Command failed: could not find symbol value for consts

Are there any workarounds?

@x-yuri
Copy link

x-yuri commented Jan 1, 2024

@aarzilli (I didn't remember the part about non-integer constants when I was posting the message.)

Can you possibly explain why non-integer constants are not exported? C for one doesn't seem to have problems with them.

@aarzilli
Copy link
Contributor

aarzilli commented Jan 1, 2024

Can you possibly explain why non-integer constants are not exported?

They just aren't.

@aclements aclements changed the title cmd/compile: constant inlining happens even when disabling inlining and optimizations cmd/compile: export non-integer constants to debug info Jan 2, 2024
@aclements
Copy link
Member

I've retitled this issue because it's unrelated to inlining. Really this is a feature request for the compiler to include non-integer constants in the debug info. Once we do that, debuggers will be able to access them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Debugging NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants