go-delve / delve

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

Support map evaluation by composite literal keys #1465

Open maxwindiff opened 5 years ago

maxwindiff commented 5 years ago
  1. What version of Delve are you using (dlv version)?
$ dlv version
Delve Debugger
Version: 1.1.0
Build: $Id: 1990ba12450cab9425a2ae62e6ab988725023d5c $
  1. What version of Go are you using? (go version)?
$ go version
go version go1.11.2 linux/amd64
  1. What operating system and processor architecture are you using?

Linux/amd64

  1. What did you do?

Compile the following program, debug it with delve, try to print some map values:

package main

import "fmt"

type Pair struct {
        A, B int
}

func main() {
        m := map[Pair]string{}
        m[Pair{A: 1, B: 1}] = "x"
        m[Pair{A: 1, B: 2}] = "y"
        fmt.Println(m)
}
$ dlv debug test.go
(dlv) b main.main:4
...
(dlv) c
...
(dlv) p m[main.Pair{A: 1, B: 1}]
Command failed: expression *ast.CompositeLit not implemented
(dlv) p m[Pair{A: 1, B: 1}]
Command failed: expression *ast.CompositeLit not implemented
  1. What did you expect to see?

Print the corresponding map values.

  1. What did you see instead?

"Command failed: expression *ast.CompositeLit not implemented"

Looks like CompositeLit evaluation wasn't implemented: https://github.com/go-delve/delve/blob/4c9a72e486f1f0d0c90ecede8415a871dced8117/pkg/proc/eval.go#L258

apmattil commented 4 years ago

any progress here ? I think this is really important feature.. at least with cmd-line debugging.

1Mark commented 2 years ago

Any update on this please?

Ap3lsin4k commented 1 year ago

The issue expression *ast.CompositeLit not implemented is the same for GoLand.

I am encouraged to write more unit tests because the debugger is inconvenient to use. Maybe the absence of "composite literal evaluation" is a well-thought feature, not a bug :smiley:

glezjose commented 1 year ago

Any luck? Having the same issue with GoLand

debemdeboas commented 6 months ago

Incredible how such a (seemingly) simple feature has been left behind by the team!