Skip to content

v1.26.2: panic in parseFileEntries5 (slice bounds out of range) when loading Go 1.26.x binaries on darwin/arm64, regression since v1.26.1 #4311

@andersonjohnf

Description

@andersonjohnf

Version of Delve

  • v1.26.2 (tagged) — broken
  • master @ v1.26.3-0.20260421122345-0c15a4835a4bstill broken, same panic
  • v1.26.1works

All three built with go1.26.2.

Platform

  • macOS (darwin) on arm64 (Apple Silicon, M-series)
  • Go 1.26.2

What happened

Launching a Go 1.26.2 binary under dlv dap (via the VS Code Go extension) causes Delve to panic in its DWARF 5 line-parser during binary-info load. In v1.26.2, the panic crashes the DAP session so the debugger fails to attach at all. In master, the panic is still present but the target process continues to launch because the panic happens in a worker goroutine that is no longer fatal to the parent load — however, debug info for the affected compilation unit is incomplete, so breakpoints and stepping silently misbehave in parts of the program.

Downgrading to v1.26.1 (built against the same Go 1.26.2 toolchain) restores full functionality, so the regression was introduced between v1.26.1 and v1.26.2.

Expected

dlv dap loads the binary info cleanly and the DAP session attaches, as it did under v1.26.1.

Actual — panic trace (v1.26.2, trimmed to the relevant frames)

Building ./main.go
panic: runtime error: slice bounds out of range [14:0]

goroutine 71 gp=0x4f87c72650e0 m=15 mp=0x4f87c7c00808 [running]:
panic({0x1037f68a0?, 0x4f87cb6eb980?})
    .../runtime/panic.go:879 +0x15c
runtime.panicBounds64(...)
runtime.panicBounds()
github.com/go-delve/delve/pkg/dwarf/line.parseFileEntries5(0x4f87c9961760, 0x4f87cac35320)
    .../delve@v1.26.2/pkg/dwarf/line/line_parser.go:315 +0x4d0
github.com/go-delve/delve/pkg/dwarf/line.Parse({0x4f87cd09fc20, 0xd}, 0x4f87cac35320, {0x0, 0x0, 0x0}, 0x0, 0x610000, 0x0, 0x8)
    .../delve@v1.26.2/pkg/dwarf/line/line_parser.go:104 +0x228
github.com/go-delve/delve/pkg/proc.(*BinaryInfo).loadDebugInfoMaps(...)
    .../delve@v1.26.2/pkg/proc/bininfo.go:2650 +0x7bc
github.com/go-delve/delve/pkg/proc.loadBinaryInfoMacho.gowrap2()
    .../delve@v1.26.2/pkg/proc/bininfo.go:2155 +0x30
runtime.goexit({})
created by github.com/go-delve/delve/pkg/proc.loadBinaryInfoMacho in goroutine 22
    .../delve@v1.26.2/pkg/proc/bininfo.go:2155 +0x55c

The panic fires in parseFileEntries5 at the slice operation on line 315 — a 14-byte read against a 0-length remainder of the DWARF section, suggesting the parser has advanced past the actual end of a file_name entry group while reading the DWARF 5 line-table header.

Steps to reproduce

  1. On darwin/arm64 with Go 1.26.2, install Delve v1.26.2: go install github.com/go-delve/delve/cmd/dlv@v1.26.2.
  2. Build any non-trivial Go 1.26.2 program (I hit it on a ~50-dep Go module using gin, firestore, pgx, livekit/protocol, and other common deps; happy to test a minimal repro if helpful).
  3. Launch under dlv dap (e.g. via the VS Code Go extension's default Go debug config) against ./cmd/<binary>.
  4. Panic fires before the DAP session attaches.

Downgrading to v1.26.1 with no other changes (go install github.com/go-delve/delve/cmd/dlv@v1.26.1) makes the problem go away.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions