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

[delve/pkg/dwarf] panic: runtime error: slice bounds out of range #3873

Open
amalavet opened this issue Dec 4, 2024 · 6 comments
Open

[delve/pkg/dwarf] panic: runtime error: slice bounds out of range #3873

amalavet opened this issue Dec 4, 2024 · 6 comments

Comments

@amalavet
Copy link

amalavet commented Dec 4, 2024

For certain applications, Delve is panicking when I attempt to debug. This issue is only present for some of my go projects, some applications I can debug without issue.

  1. What version of Delve are you using (dlv version)?
Delve Debugger
Version: 1.23.1
Build: $Id: 2eba762d75437d380e48fc42213853f13aa2904d $
  1. What version of Go are you using? (go version)?
go version go1.23.3 darwin/arm64
  1. What operating system and processor architecture are you using?
darwin/arm64 (MacOS)
  1. What did you do?
❯ dlv debug cmd/server/main.go
  1. What did you expect to see?
Type 'help' for list of commands.
(dlv)
  1. What did you see instead?
panic: runtime error: slice bounds out of range [74:0]

goroutine 7 [running]:
github.com/go-delve/delve/pkg/dwarf/line.parseIncludeDirs5(0x14003cc3810, 0x1400419d1a0)
        REDACTED/go/1.23.3/pkg/mod/github.com/go-delve/[email protected]/pkg/dwarf/line/line_parser.go:188 +0x460
github.com/go-delve/delve/pkg/dwarf/line.Parse({0x14006b3e630, 0xd}, 0x1400419d1a0, {0x0, 0x0, 0x0}, 0x0, 0x76c000, 0x0, 0x8)
        REDACTED/go/1.23.3/pkg/mod/github.com/go-delve/[email protected]/pkg/dwarf/line/line_parser.go:100 +0x23c
github.com/go-delve/delve/pkg/proc.(*BinaryInfo).loadDebugInfoMaps(0x1400023e000, 0x140016bc000, {0x14003c42000, 0x9b6289, 0x9b6289}, {0x14004768000, 0x6cf93a, 0x6cf93a}, 0x140016943c0, 0x14000242200)
        REDACTED/go/1.23.3/pkg/mod/github.com/go-delve/[email protected]/pkg/proc/bininfo.go:2478 +0x7a8
created by github.com/go-delve/delve/pkg/proc.loadBinaryInfoMacho in goroutine 1
        REDACTED/go/1.23.3/pkg/mod/github.com/go-delve/[email protected]/pkg/proc/bininfo.go:2017 +0x590

Also, here is my go env

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='REDACTED/Library/Caches/go-build'
GOENV='REDACTED/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='REDACTED/go/1.23.3/pkg/mod'
GONOPROXY=''
GONOSUMDB=REDACTED
GOOS='darwin'
GOPATH='REDACTED/go/1.23.3'
GOPRIVATE=''
GOPROXY=REDACTED
GOROOT='REDACTED/.goenv/versions/1.23.3'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='REDACTED/.goenv/versions/1.23.3/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='REDACTED/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='/usr/local/bin/gcc'
CXX='/usr/bin/g++'
CGO_ENABLED='1'
GOMOD='REDACTED/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fmessage-length=0 -ffile-prefix-map=/var/folders/p2/r1fr92ns20dggzgnmv20w1p80000gn/T/go-build3234217224=/tmp/go-build -gno-record-gcc-switches -fno-common'
@amalavet
Copy link
Author

amalavet commented Dec 4, 2024

I notice here that MacOS darwin/arm64 is not on the supported list. Could this be the issue, and if so, is there a plan to support Apple's M series of processors?

@amalavet
Copy link
Author

amalavet commented Dec 4, 2024

Update, setting CGO_ENABLED=0 seems to provide a fix for projects that don't require it

@aarzilli
Copy link
Member

aarzilli commented Dec 5, 2024

Darwin/arm64 is supported. There is probably a bug in our implementation of DWARFv5, it would be very helpful if you could share the binary file that produces this error, even privately. Alternatively can you post the output of dlv debug --log --log-output=debugger ... as well as use go build -gcflags='all=-N -l' -o executable ... to compile and then run otool -l executable.

@amalavet
Copy link
Author

amalavet commented Dec 6, 2024

Will send logs shortly

@amalavet
Copy link
Author

amalavet commented Dec 17, 2024

Unfortunately, because the issue is occurring when debugging internal software at my company, I cannot provide anything beyond what I have already shared.

@aarzilli
Copy link
Member

Not even the names of the sections returned by otool -l? I'd have to close this as not-reproducible.

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