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

panic: runtime error: index out of range #1572

Closed
chendave opened this issue Jun 5, 2019 · 5 comments
Closed

panic: runtime error: index out of range #1572

chendave opened this issue Jun 5, 2019 · 5 comments

Comments

@chendave
Copy link

chendave commented Jun 5, 2019

Please answer the following before submitting your issue:

Note: Please include any substantial examples (debug session output,
stacktraces, etc) as linked gists.

  1. What version of Delve are you using (dlv version)?
    Delve Debugger
    Version: 1.2.0
    Build: $Id: 068e2451004e95d0b042e5257e34f0f08ce01466 $

  2. What version of Go are you using? (go version)?
    go version go1.10.4 linux/amd64

  3. What operating system and processor architecture are you using?

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

# uname -a
Linux dave-desktop 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  1. What did you do?
    I am trying to debug a static bianry, the debug used to be work, but doesn't work now, what I did is upgrade go to latest version, and I reverted it back after I saw the error. I can debug successfully with a simple go binary instead.

# dlv exec ...

  1. What did you expect to see?
  2. What did you see instead?
...
panic: runtime error: index out of range

goroutine 35 [running]:
github.com/go-delve/delve/pkg/proc.(*BinaryInfo).loadDebugInfoMapsCompileUnit(0xc420001380, 0xc42000c520, 0xc42022c000, 0xc4200663c0, 0xc42051c090, 0xc420520200)
        /go/src/github.com/go-delve/delve/pkg/proc/types.go:426 +0x173f
github.com/go-delve/delve/pkg/proc.(*BinaryInfo).loadDebugInfoMaps(0xc420001380, 0xc42022c000, 0xc4203b6000, 0x86bc, 0x86bc, 0xc4201c41b0, 0x0)
        /go/src/github.com/go-delve/delve/pkg/proc/types.go:266 +0x59e
created by github.com/go-delve/delve/pkg/proc.loadBinaryInfoElf
        /go/src/github.com/go-delve/delve/pkg/proc/bininfo.go:848 +0x39a
@aarzilli
Copy link
Member

aarzilli commented Jun 5, 2019

Does the bug happen with go 1.10 or with "the latest version" of go? What's the latest version of Go: 1.12 or a build from master? If you are using exec how did you build the executable? I imagine you wouldn't agree to posting the executable anywhere?

@chendave
Copy link
Author

chendave commented Jun 6, 2019

@aarzilli , thanks for your reply!

Does the bug happen with go 1.10 or with "the latest version" of go?

I tried latest version of go but failed to debug with some error, I am not sure whether the error is exactly same or not, will post the error message later.

What's the latest version of Go: 1.12 or a build from master?

I got the latest go 1.12.5 from here: https://golang.org/dl/, cause it failed, so I fall back to use the go 1.10 installed by apt install provided by ubuntu repo, not sure what's your meaning of “build from master”.

If you are using exec how did you build the executable? I imagine you wouldn't agree to posting the executable anywhere?

I don't understand here, I always use dlv exec to debug go binary, what's your suggestion? I am still newbie to the go-delve and not familiar with all the ability the tool has.

@chendave
Copy link
Author

chendave commented Jun 6, 2019

@aarzilli , you can get the binary from there,
wget https://raw.githubusercontent.com/chendave/initrepo/master/testcode/buildkit/buildkitd

Thanks a lot for your help on this!

@chendave
Copy link
Author

chendave commented Jun 6, 2019

My understanding is this issue should be a project specific issue. I used to build the binary with go 1.12, and the project has the cache make the binary is still based on the go1.12, but the go delve is build with the different go version, so the issue occurs.

I don't think I have figured out the root cause, cause I don't know how to get rid of the cache in order to re-generate the binary, but I have tried to build it is another way so that cache is invalid and dlv works again.

Close this unless I find another clue or issue.

Thanks for help!

@chendave chendave closed this as completed Jun 6, 2019
@aarzilli aarzilli reopened this Jun 6, 2019
@aarzilli
Copy link
Member

aarzilli commented Jun 6, 2019

I always use dlv exec to debug go binary, what's your suggestion?

dlv debug is better, it will disable optimizations which provides a smoother debugger experience.

aarzilli added a commit to aarzilli/delve that referenced this issue Jun 6, 2019
Childless compile units would confuse loadDebugInfoMaps.
No test because I don't know what causes go to invoke GNU As in such a
way that it produces a childless compile unit.

Fixes go-delve#1572
aarzilli added a commit to aarzilli/delve that referenced this issue Jun 6, 2019
Childless compile units would confuse loadDebugInfoMaps.
No test because I don't know what causes go to invoke GNU As in such a
way that it produces a childless compile unit.

Fixes go-delve#1572
cgxxv pushed a commit to cgxxv/delve that referenced this issue Mar 25, 2022
…1574)

Childless compile units would confuse loadDebugInfoMaps.
No test because I don't know what causes go to invoke GNU As in such a
way that it produces a childless compile unit.

Fixes go-delve#1572
abner-chenc pushed a commit to loongson/delve that referenced this issue Mar 1, 2024
…1574)

Childless compile units would confuse loadDebugInfoMaps.
No test because I don't know what causes go to invoke GNU As in such a
way that it produces a childless compile unit.

Fixes go-delve#1572
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants