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: bad line number assigned to instruction #53456

Open
aarzilli opened this issue Jun 19, 2022 · 1 comment
Open

cmd/compile: bad line number assigned to instruction #53456

aarzilli opened this issue Jun 19, 2022 · 1 comment
Assignees
Labels
Debugging NeedsInvestigation
Milestone

Comments

@aarzilli
Copy link
Contributor

@aarzilli aarzilli commented Jun 19, 2022

Compiling the following with -gcflags='all=-N -l':

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
}

Produces a binary for main.(*T).Inc with this:

test.go:16	S	0x45fd3e	8400	TESTB AL, 0(AX)
test.go:16		0x45fd40	488b18	MOVQ 0(AX), BX
test.go:16		0x45fd43	48895c2430	MOVQ BX, 0x30(SP)
test.go:15	S	0x45fd48	488b4c2450	MOVQ 0x50(SP), CX
test.go:16	S	0x45fd4d	488d05cc5c0000	LEAQ main.(*T).Inc+23808(SB), AX
test.go:16		0x45fd54	e8a7f9faff	CALL runtime.mapaccess1_fast64(SB)  >>>

The instruction at 0x45fd48 which passes key to mapaccess1_fast64 is assigned the function's header as its line number instead of the statement it belongs to.

ref. go-delve/delve#3033
cc @dr2chase

@cagedmantis cagedmantis added the NeedsInvestigation label Jun 23, 2022
@cagedmantis cagedmantis added this to the Backlog milestone Jun 23, 2022
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Jun 23, 2022

/cc @randall77 @griesemer

@dr2chase dr2chase self-assigned this Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debugging NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

4 participants