Skip to content

runtime: line numbers reported by caller and callers doen't match #5518

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

Closed
griesemer opened this issue May 20, 2013 · 2 comments
Closed

runtime: line numbers reported by caller and callers doen't match #5518

griesemer opened this issue May 20, 2013 · 2 comments
Milestone

Comments

@griesemer
Copy link
Contributor

What steps will reproduce the problem?

1. http://play.golang.org/p/zd59eWdmqw
2. The first and second line report different line numbers (off by 1) by they should be
the same
3. The other line numbers also seem not 100% correct.
@dsymonds
Copy link
Contributor

Comment 1:

Labels changed: added priority-later, go1.2, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 2:

The output is correct. The caller PC is where the call will return. To get the PC of the
call instruction you have to back up one instruction. It suffices on all systems to back
up one byte, provided you're not already at the start of the function (meaning something
funny is going on and there was no call instruction). This is partly why runtime.Caller
returns the file and line, so that ordinary uses don't need to do this computation. But
here it is, working:
http://play.golang.org/p/lTWpWsrIT3

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 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

4 participants