{"record":{"id":"d89a31e450a3c53d","repo":"go-delve/delve","slug":"found-section-but-could-not-read-gopclntab","errorCode":null,"errorMessage":"found section but could not read .gopclntab","messagePattern":"found section but could not read \\.gopclntab","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/pclntab.go","lineNumber":27,"sourceCode":"\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\n\tsectionLabel := \"__gopclntab\"\n\n\tsection := exe.Section(sectionLabel)\n\tif section == nil {\n\t\treturn nil, 0, errors.New(\"could not read section __gopclntab\")","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/pclntab.go#L9-L45","documentation":"The .gopclntab section exists in the ELF file, but reading its bytes (section.Data()) failed. This usually means the section header is valid but the referenced bytes are truncated, outside the file, or the file is corrupted.","triggerScenarios":"loadBinaryInfoGoRuntimeElf -> readPcLnTableElf on a truncated or corrupted ELF file, a file modified after build, or exotic section types/offsets that debug/elf cannot map to file bytes.","commonSituations":"Partially downloaded or copied binaries; core/debug artifacts from broken packaging pipelines; binaries post-processed by obfuscators or packers that rewrite sections.","solutions":["Re-obtain or rebuild the binary and compare checksums against the original artifact","Check the file size matches the build output (truncated transfer)","Remove any post-processing (packers, obfuscators, section rewriting)","Open the file with readelf -S to confirm .gopclntab has a valid offset/size in the file"],"exampleFix":"// before\ndlv exec ./corrupted-binary\n// after\ngo build -o app . && dlv exec ./app // rebuild from a known-good source","handlingStrategy":"validation","validationCode":"fi, err := os.Stat(path)\nif err != nil || fi.Size() == 0 {\n    return fmt.Errorf(\"binary missing or empty: %s\", path)\n}\n// optionally compare against a known checksum","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"found section but could not read .gopclntab\") {\n    return fmt.Errorf(\"binary file appears corrupted/truncated: %w\", err)\n}","preventionTips":["Verify checksums of binaries before debugging","Avoid post-build processing (packers, obfuscators) that rewrites sections","Re-transfer files if downloads/copying may have been interrupted"],"tags":["elf","pclntab","corrupt-binary"],"backgroundTag":"missing-pclntab-section","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}