{"record":{"id":"10ff3459bb2435d1","repo":"go-delve/delve","slug":"could-not-read-section-gopclntab","errorCode":null,"errorMessage":"could not read section .gopclntab","messagePattern":"could not read section \\.gopclntab","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/pclntab.go","lineNumber":22,"sourceCode":"\t\"debug/elf\"\n\t\"debug/macho\"\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/go-delve/delve/pkg/internal/gosym\"\n)\n\nfunc readPcLnTableElf(exe *elf.File, path string) (*gosym.Table, uint64, error) {\n\t// Default section label is .gopclntab\n\tsectionLabel := \".gopclntab\"\n\n\tsection := exe.Section(sectionLabel)\n\tif section == nil {\n\t\t// binary may be built with -pie\n\t\tsectionLabel = \".data.rel.ro.gopclntab\"\n\t\tsection = exe.Section(sectionLabel)\n\t\tif section == nil {\n\t\t\treturn nil, 0, errors.New(\"could not read section .gopclntab\")\n\t\t}\n\t}\n\ttableData, err := section.Data()\n\tif err != nil {\n\t\treturn nil, 0, errors.New(\"found section but could not read .gopclntab\")\n\t}\n\n\taddr := exe.Section(\".text\").Addr\n\tlineTable := gosym.NewLineTable(tableData, addr)\n\tsymTable, err := gosym.NewTable([]byte{}, lineTable)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"could not create symbol table from  %s \", path)\n\t}\n\treturn symTable, section.Addr, nil\n}\n\nfunc readPcLnTableMacho(exe *macho.File, path string) (*gosym.Table, uint64, error) {\n\t// Default section label is __gopclntab","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/pclntab.go#L4-L40","documentation":"readPcLnTableElf cannot locate the Go pclntab section (.gopclntab) in an ELF binary, nor its PIE-relocated variant (.data.rel.ro.gopclntab). Delve needs this table for Go-runtime function metadata when DWARF-based lookup falls back to runtime tables.","triggerScenarios":"Loading (attach/exec/core) an ELF binary whose symbolization falls back to loadBinaryInfoGoRuntimeElf but that contains neither .gopclntab nor .data.rel.ro.gopclntab — typically a non-Go binary, a stripped Go binary, or one built/linked with an unusual toolchain.","commonSituations":"Attaching delve to a C/C++ program that happens to be loaded in a mixed-process scenario; analyzing a Go binary stripped with objcopy that removed the section; very old Go versions or cgo-heavy builds with different section layout.","solutions":["Verify the binary was produced by the Go toolchain (go version -m <binary>)","Do not strip Go binaries with external strippers; keep .gopclntab intact","Rebuild with a supported Go version and without -ldflags that remove runtime sections","Confirm the binary architecture/format matches what delve was asked to open"],"exampleFix":"// before\ngo build -ldflags=\"-s -w\" -o app . && strip app\n// after\ngo build -o app . // keep pclntab and symbol metadata","handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"go\", \"version\", \"-m\", binaryPath).Output()\nif !strings.Contains(string(out), \"go\") {\n    return fmt.Errorf(\"%s is not a Go binary\", binaryPath)\n}","typeGuard":null,"tryCatchPattern":"_, _, err := loadBinaryInfo(path)\nif err != nil && strings.Contains(err.Error(), \"could not read section .gopclntab\") {\n    return fmt.Errorf(\"not a Go-built ELF binary (or pclntab stripped): %w\", err)\n}","preventionTips":["Only open Go-built binaries with the Go-runtime symbolization path","Never strip Go binaries with external strippers (strip/objcopy)","Match delve's Go version support with the target's toolchain version"],"tags":["elf","pclntab","binary-format"],"backgroundTag":"missing-pclntab-section","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}