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 pcln association for calls to race.funcenter when compiling with -race and -gcflags '-N -l' #22600

Closed
aarzilli opened this issue Nov 6, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@aarzilli
Copy link
Contributor

commented Nov 6, 2017

go version devel +936b977 Sat Nov 4 11:09:49 2017 +0000 linux/amd64

Given:

package main

import (
	"fmt"
	"os"
)

func main() {
	pwd, err := os.Getwd()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println(pwd)
}

main function is compiled to:

  workdir.go:8          0x4f9eb0                64488b0c25f8ffffff              MOVQ FS:0xfffffff8, CX                  
  workdir.go:8          0x4f9eb9                488d842470ffffff                LEAQ 0xffffff70(SP), AX                 
  workdir.go:8          0x4f9ec1                483b4110                        CMPQ 0x10(CX), AX                       
  workdir.go:8          0x4f9ec5                0f86c0020000                    JBE 0x4fa18b                            
  workdir.go:8          0x4f9ecb                4881ec10010000                  SUBQ $0x110, SP                         
  workdir.go:8          0x4f9ed2                4889ac2408010000                MOVQ BP, 0x108(SP)                      
  workdir.go:8          0x4f9eda                488dac2408010000                LEAQ 0x108(SP), BP                      
  workdir.go:14         0x4f9ee2                488b842410010000                MOVQ 0x110(SP), AX                      
  workdir.go:14         0x4f9eea                48890424                        MOVQ AX, 0(SP)                          
  workdir.go:14         0x4f9eee                e8ad1ff8ff                      CALL runtime.racefuncenter(SB)          
  workdir.go:9          0x4f9ef3                0f57c0                          XORPS X0, X0                            
  workdir.go:9          0x4f9ef6                0f118424b8000000                MOVUPS X0, 0xb8(SP)                     

it doesn't make sense that the call to runtime.racefuncenter would be associated to workdir.go:14.

aarzilli added a commit to aarzilli/delve that referenced this issue Nov 10, 2017

pkg/prog/test: add flag to run target with -race flag
Adds test command line flag to compile target fixtures using the -race flag.
Multiple tests will fail because of golang/go#22600
but eventually this should work.

aarzilli added a commit to aarzilli/delve that referenced this issue Nov 10, 2017

pkg/prog/test: add flag to run target with -race flag
Adds test command line flag to compile target fixtures using the -race flag.
Multiple tests will fail because of golang/go#22600
but eventually this should work.

derekparker added a commit to go-delve/delve that referenced this issue Nov 15, 2017

pkg/prog/test: add flag to run target with -race flag
Adds test command line flag to compile target fixtures using the -race flag.
Multiple tests will fail because of golang/go#22600
but eventually this should work.
@derekparker

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2017

@heschik heschik added the Debugging label Nov 15, 2017

@heschik

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2017

@dr2chase is looking into these issues.

@dr2chase dr2chase self-assigned this Nov 16, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Nov 16, 2017

Change https://golang.org/cl/78336 mentions this issue: cmd/compile: leave Pos unset for racewalk enter/exit

@gopherbot gopherbot closed this in d2414ce Nov 17, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Nov 27, 2017

Change https://golang.org/cl/80115 mentions this issue: cmd/compile: adjust lineno during import to get Pos right

gopherbot pushed a commit that referenced this issue Nov 28, 2017

cmd/compile: adjust lineno during import to get Pos right
Binary import sometimes constructs nodes using functions
that use the global lineno for the Position.  This causes
spurious numbers to appear in the assembly and the
debugging output.

Fix (targeted, because late in the cycle): save and restore
lineno around bimport calls known to use lineno-sensitive
functions.

Updates #22600.
(Comment: "This is a weird line to step through")

Change-Id: I9c4094670380609fe4b6696443fb02579521c596
Reviewed-on: https://go-review.googlesource.com/80115
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>

@golang golang locked and limited conversation to collaborators Nov 27, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.