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: DWARF Incorrect location list #47850

Open
mahdi-hm opened this issue Aug 20, 2021 · 2 comments
Open

cmd/compile: DWARF Incorrect location list #47850

mahdi-hm opened this issue Aug 20, 2021 · 2 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mahdi-hm
Copy link

mahdi-hm commented Aug 20, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16.7 linux/amd64

Does this issue reproduce with the latest release?

The problem exists on 1.14.9 and 1.17RC2 as well

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mahdi/.cache/go-build"
GOENV="/home/mahdi/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/mahdi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/mahdi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.7"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build275819546=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Using some debuggers like Delve I tried to debug below code and monitor some local variable inside printParams function. I put a break point on line 16 which is the 5th line in the mentioned function using break main.printParams:5

package main

import "fmt"

func printParams(b2 [][]int, p2 *[][]int) {
	fmt.Println("Entering printParams")
	b2[1] = append(b2[1], 99)
	for i := 0; i < len(b2); i++ {
		for j := 0; j < len(b2[i]); j++ {
			fmt.Println(b2[i][j])
		}
	}
	fmt.Println((*p2)[0][0])
	fmt.Println("Exiting printParams")
}

func main() {
	var slice = make([][]int, 2)

	slice[0] = []int{11, 12, 13}
	slice[1] = []int{21, 22, 23}
	slice[1] = append(slice[1], 24)

	printParams(slice, &slice)
}

What did you expect to see?

When stopping at line 16 and tried to read the local variable using locals in delve, the result was this:

i = (unreadable could not find loclist entry at 0x86495 for address 0x49772a)
j = 0

What did you see instead?

I expected to be able to see the value of variable i something like below:

i = 0
j = 0
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 20, 2021
@mknyszek mknyszek added this to the Backlog milestone Aug 20, 2021
@mknyszek
Copy link
Contributor

CC @dr2chase

@dr2chase
Copy link
Contributor

dr2chase commented Apr 8, 2022

Looked into this as part of working on another location list problem, and at least for me (with an as-yet-unpublished dev version) part of the problem is that there are two "lines" recorded for that line, the first one is good (i and j are visible) but the second one is not -- and if you set a breakpoint, it chooses the second one.

@dr2chase dr2chase self-assigned this May 19, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Triage Backlog
Development

No branches or pull requests

4 participants