{"record":{"id":"9eefbf95eca51127","repo":"go-delve/delve","slug":"could-not-read-section-gopclntab-9eefbf","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":45,"sourceCode":"\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\")\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","sourceCodeStart":27,"sourceCodeEnd":60,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/pclntab.go#L27-L60","documentation":"readPcLnTableMacho cannot find the __gopclntab section in a macOS Mach-O binary. Unlike the ELF path, there is no fallback section name. Delve requires this section to build the gosym line table for Go runtime symbolization.","triggerScenarios":"Opening a Mach-O binary via loadBinaryInfoGoRuntimeMacho that lacks __gopclntab — non-Go binaries, stripped Go binaries, or Go binaries built with toolchains that place pclntab elsewhere.","commonSituations":"Debugging a C/C++ macOS executable; a Go binary stripped of its pclntab; universal/fat binaries handled by extracting the wrong slice; third-party signed/re-signed app bundles that altered sections.","solutions":["Verify the target is a Go binary (go version -m <binary>)","Rebuild without stripping pclntab (avoid objcopy/strip on Go macOS binaries)","Check that you are debugging the correct architecture slice of a fat binary","Use a delve version matching your Go toolchain version"],"exampleFix":"// before\nstrip app && dlv exec app\n// after\ngo build -o app . && dlv exec app","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":"if err != nil && strings.Contains(err.Error(), \"could not read section __gopclntab\") {\n    return fmt.Errorf(\"not a Go-built Mach-O binary (or pclntab stripped): %w\", err)\n}","preventionTips":["Confirm the binary is Go-built before Mach-O runtime symbolization","Do not strip macOS Go binaries; keep __gopclntab","Select the correct architecture slice when handling fat binaries"],"tags":["macos","macho","pclntab"],"backgroundTag":"missing-pclntab-section","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}