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

debug/gosym: tests fail when externally linked #9912

Closed
mwhudson opened this issue Feb 17, 2015 · 2 comments
Closed

debug/gosym: tests fail when externally linked #9912

mwhudson opened this issue Feb 17, 2015 · 2 comments
Milestone

Comments

@mwhudson
Copy link
Contributor

This once again falls into the "maybe we don't really care" category, but:

mwhudson@narsil:src$ go.master test -ldflags '-linkmode external' debug/gosym -short
--- FAIL: TestLineFromAline (0.17s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x58 pc=0x4f89e2]

goroutine 4 [running]:
testing.func·006(0xc208064000)
    /opt/opensource/go.master/src/testing/testing.go:442 +0x179
debug/elf.(*Section).Data(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /opt/opensource/go.master/src/debug/elf/file.go:77 +0x42
debug/gosym.parse(0x7fffceb44e7f, 0x33, 0xc2080601e0, 0xc208064000, 0x0, 0x0)
    /opt/opensource/go.master/src/debug/gosym/pclntab_test.go:87 +0x5b
debug/gosym.crack(0x7fffceb44e7f, 0x33, 0xc208064000, 0x47d88f, 0xc208030d10)
    /opt/opensource/go.master/src/debug/gosym/pclntab_test.go:83 +0x148
debug/gosym.getTable(0xc208064000, 0x641a10)
    /opt/opensource/go.master/src/debug/gosym/pclntab_test.go:72 +0x4c
debug/gosym.TestLineFromAline(0xc208064000)
    /opt/opensource/go.master/src/debug/gosym/pclntab_test.go:116 +0x78
testing.tRunner(0xc208064000, 0x8d0840)
    /opt/opensource/go.master/src/testing/testing.go:448 +0xad
created by testing.RunTests
    /opt/opensource/go.master/src/testing/testing.go:556 +0xa4c

goroutine 1 [chan receive]:
testing.RunTests(0x641a98, 0x8d0840, 0x3, 0x3, 0x1)
    /opt/opensource/go.master/src/testing/testing.go:557 +0xa8c
testing.(*M).Run(0xc20805a0a0, 0x903c40)
    /opt/opensource/go.master/src/testing/testing.go:486 +0x79
main.main()
    debug/gosym/_test/_testmain.go:56 +0x1d5
FAIL    debug/gosym 0.173s

The immediate failure is that f.Section(".gosymtab") is returning nil (because there is indeed no section with this name in an externally linked binary) and this is not being checked before .Data() is called on the return value. I don't know if debug/gosym is expected to work in the external linking case but the failure mode seems unfortunate.

@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

The failure error should be made clearer. I think this can only work without external linking, and that's fine. It's testing legacy code.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@mwhudson
Copy link
Contributor Author

I forgot to tag the issue in the CL that fixed this.

@mikioh mikioh modified the milestones: Go1.5, Unplanned Apr 12, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
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