go-delve / delve

Delve is a debugger for the Go programming language.
MIT License
22.37k stars 2.13k forks source link

Unable to print a package string const value during a breakpoint #3737

Closed Benoit12345 closed 1 month ago

Benoit12345 commented 1 month ago

1. What version of Delve are you using (dlv version)? Version: 1.22.1 Build: $Id: 0c3470054da6feac5f6dcf3e3e5144a64f7a9a48 $

2. What version of Go are you using? (go version)? go version go1.22.3 linux/amd64

3. What operating system and processor architecture are you using? Linux 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

4. What did you do? I put a breakpoint into any function and try to print a package const value.

Code:

_const myValueStr = "try" const myValueInt = 12

func DoSomething() { fmt.Println("Instruction only to put a breakpoint") }_

5. What did you expect to see? See the const value regardless its type (int vs string)

6. What did you see instead? const int values work fine. const string values returns : _

(dlv) print %v myValueInt 12 (dlv) print %v myValueStr Command failed: could not find symbol value for myValueStr

_

aarzilli commented 1 month ago

Constant strings are not exported by the compiler.