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

cgo: runtime.Caller() returns wrong source file name and line number when source file imports C #6092

Closed
pebbe opened this issue Aug 9, 2013 · 6 comments
Milestone

Comments

@pebbe
Copy link
Contributor

pebbe commented Aug 9, 2013

What steps will reproduce the problem?

See attached programs caller1.go and caller2.go

1. go run caller1.go
2. go run caller2.go

What is the expected output?

This is Go
/home/peter/go/caller1.go:20: This is an error

This is C
This is Go
/home/peter/go/caller2.go:20: This is an error


What do you see instead?

This is Go
/home/peter/go/caller1.go:20: This is an error

This is C
This is Go
command-line-arguments/_obj/caller2.cgo1.go:22: This is an error


Which compiler are you using (5g, 6g, 8g, gccgo)?
Which operating system are you using?
Which version are you using?  (run 'go version')

go version go1.1.1 linux/amd64

Attachments:

  1. caller1.go (441 bytes)
  2. caller2.go (437 bytes)
@pebbe
Copy link
Contributor Author

pebbe commented Aug 9, 2013

Comment 1:

Compiler is 6g

@robpike
Copy link
Contributor

robpike commented Aug 10, 2013

Comment 3:

The line numbers correctly point to the Go source code. Yes, the actual code is in a
generated file but almost always people prefer the errors to refer to the original file,
not the generated one. Working as intended.

Labels changed: added cgo.

Status changed to WorkingAsIntended.

@dvyukov
Copy link
Member

dvyukov commented Aug 11, 2013

Comment 4:

Rob, I do not understand. You say "Yes, the actual code is in a generated file but
almost always people prefer the errors to refer to the original file, not the generated
one".
And this is not what we currently do, we point into generated file, and you say that
this is intended.

@robpike
Copy link
Contributor

robpike commented Aug 11, 2013

Comment 5:

Turning back to status Accepted.
I cannot reproduce the problem on my machine, but if you thin it's real that's enough
for me.
I

Status changed to Accepted.

@dvyukov
Copy link
Member

dvyukov commented Aug 11, 2013

Comment 6:

I have not tried to reproduce, I am just looking at the report:
What do you see instead?
command-line-arguments/_obj/caller2.cgo1.go:22: This is an error

@ianlancetaylor
Copy link
Member

Comment 7:

This works as expected on tip.  It is broken in the Go 1.1.1 release.  I'm not sure what
fixed it on tip; it may have had something to do with http://golang.org/s/go12symtab.
Thanks for reporting the bug.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants