Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-111492

delve command 'locals' does not print local variables with go1.25 [rhel-10]

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-10.2
    • rhel-10.1
    • delve
    • None
    • delve-1.25.2-1.el10
    • No
    • Moderate
    • rhel-pt-go
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      With latest golang-1.25.0-1.el10, delve-1.24.1-2.el10 no longer prints local variables when issuing locals command (see (no locals) in the output below):

      [root@vm ~]# rpm -qa golang delve
      delve-1.24.1-2.el10.x86_64
      golang-1.25.0-1.el10.x86_64
      [root@vm ~]# cat hello.go 
      package main
      
      import "fmt"
      
      func hello_world() {
          fmt.Println("Hello World")
      }
      
      func main() {
          i := 10
          hello_world()
          i--
      }
      [root@vm ~]# cat init.txt 
      break main.main
      continue
      next
      break hello_world
      continue
      next 4
      locals
      continue
      exit
      [root@vm ~]# dlv debug hello.go --init ./init.txt --check-go-version=false
      WARNING: undefined behavior - version of Delve is too old for Go version go1.25.0 (maximum supported version 1.24)
      Type 'help' for list of commands.
      Breakpoint 1 set at 0x4b6d6a for main.main() ./hello.go:9
      > [Breakpoint 1] main.main() ./hello.go:9 (hits goroutine(1):1 total:1) (PC: 0x4b6d6a)
           4:	
           5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
      =>   9:	func main() {
          10:	    i := 10
          11:	    hello_world()
          12:	    i--
          13:	}
      > main.main() ./hello.go:10 (PC: 0x4b6d6e)
           5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
           9:	func main() {
      =>  10:	    i := 10
          11:	    hello_world()
          12:	    i--
          13:	}
      Breakpoint 2 set at 0x4b6cea for main.hello_world() ./hello.go:5
      > [Breakpoint 2] main.hello_world() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4b6cea)
           1:	package main
           2:	
           3:	import "fmt"
           4:	
      =>   5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
           9:	func main() {
          10:	    i := 10
      Hello World
      > main.main() ./hello.go:13 (PC: 0x4b6d7f)
           8:	
           9:	func main() {
          10:	    i := 10
          11:	    hello_world()
          12:	    i--
      =>  13:	}
      (no locals)
      ./init.txt:8: Process 21923 has exited with status 0
      

      This is probably due to the new dwarf5 format defined as default on go1.25, since it works as expected when using GOEXPERIMENT=nodwarf5 (locals returns i = 9):

      [root@vm ~]# GOEXPERIMENT=nodwarf5 dlv debug hello.go --init ./init.txt --check-go-version=false
      WARNING: undefined behavior - version of Delve is too old for Go version go1.25.0 (maximum supported version 1.24)
      Type 'help' for list of commands.
      Breakpoint 1 set at 0x4b6d6a for main.main() ./hello.go:9
      > [Breakpoint 1] main.main() ./hello.go:9 (hits goroutine(1):1 total:1) (PC: 0x4b6d6a)
           4:	
           5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
      =>   9:	func main() {
          10:	    i := 10
          11:	    hello_world()
          12:	    i--
          13:	}
      > main.main() ./hello.go:10 (PC: 0x4b6d6e)
           5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
           9:	func main() {
      =>  10:	    i := 10
          11:	    hello_world()
          12:	    i--
          13:	}
      Breakpoint 2 set at 0x4b6cea for main.hello_world() ./hello.go:5
      > [Breakpoint 2] main.hello_world() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4b6cea)
           1:	package main
           2:	
           3:	import "fmt"
           4:	
      =>   5:	func hello_world() {
           6:	    fmt.Println("Hello World")
           7:	}
           8:	
           9:	func main() {
          10:	    i := 10
      Hello World
      > main.main() ./hello.go:13 (PC: 0x4b6d7f)
           8:	
           9:	func main() {
          10:	    i := 10
          11:	    hello_world()
          12:	    i--
      =>  13:	}
      i = 9
      ./init.txt:8: Process 22406 has exited with status 0
      

              go-maint@redhat.com Go Maint
              rhn-support-emachado Edjunior Machado
              Go Maint Go Maint
              Edjunior Machado Edjunior Machado
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: