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

Wrong position after next command on a line accessing a map field in receiver #3033

Closed
nd opened this issue Jun 15, 2022 · 1 comment
Closed

Comments

@nd
Copy link
Contributor

nd commented Jun 15, 2022

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.8.3
Build: 10332d6700eba669d7dee8a560ca31acdf8fd6f5
  1. What version of Go are you using? (go version)?
go version go1.18.3 windows/amd64
  1. What operating system and processor architecture are you using?
windows/amd64
  1. What did you do?

Debugged the program with breakpoint on line 16

package main

type T struct {
	m map[int]int
}

func main() {
	t := T{
		m: make(map[int]int),
	}
	t.Inc(5)
	t.Inc(7)
}

func (s *T) Inc(key int) {
	v := s.m[key] // break, line 16
	v++
	s.m[key] = v // also here
}

Once breakpoint is reached issued the 'next' command.

  1. What did you expect to see?

Debugger stops at the next line.

  1. What did you see instead?

Debugger stops at the method header line, one more 'next' brings us back to the line with a breakpoint, one more 'next' moves to the next line 17. It looks like it happens on access to a map field of the receiver, e.g. it happens on line 18 as well.

Same behavior in go1.17.11, but works as expected in go 1.16.15.

@aarzilli
Copy link
Member

I'm closing this since there's the upstream issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants