{"record":{"id":"f2705030a0669b44","repo":"golang/go","slug":"no-dwarf-data-in-plan-9-file","errorCode":null,"errorMessage":"no DWARF data in Plan 9 file","messagePattern":"no DWARF data in Plan 9 file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/plan9obj.go","lineNumber":149,"sourceCode":"\nfunc (f *plan9File) goarch() string {\n\tswitch f.plan9.Magic {\n\tcase plan9obj.Magic386:\n\t\treturn \"386\"\n\tcase plan9obj.MagicAMD64:\n\t\treturn \"amd64\"\n\tcase plan9obj.MagicARM:\n\t\treturn \"arm\"\n\t}\n\treturn \"\"\n}\n\nfunc (f *plan9File) loadAddress() (uint64, error) {\n\treturn 0, fmt.Errorf(\"unknown load address\")\n}\n\nfunc (f *plan9File) dwarf() (*dwarf.Data, error) {\n\treturn nil, errors.New(\"no DWARF data in Plan 9 file\")\n}\n","sourceCodeStart":131,"sourceCodeEnd":151,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/plan9obj.go#L131-L151","documentation":"Returned unconditionally by plan9File.dwarf() in cmd/internal/objfile. Plan 9 a.out executables do not embed DWARF debug sections, so the objfile abstraction reports that DWARF is unavailable for this file type. It is the by-design 'not supported' answer for the Plan 9 backend.","triggerScenarios":"Calling (*objfile.Entry).DWARF() on an Entry wrapping a Plan 9 a.out (detected by plan9obj magic). pprof or symbol tooling reading a binary built for a Plan 9 target.","commonSituations":"Cross-building for Plan 9 (GOOS=plan9) and then running a pprof/DWARF-consuming tool on the resulting binary. Using objfile on a Plan 9 binary expecting the same debug data as ELF.","solutions":["Accept that Plan 9 binaries have no DWARF; fall back to the gosym table or Plan 9 symbol table for symbolization.","If DWARF is required, build for a target whose format carries it (ELF/Mach-O/PE) instead of plan9.","Detect the file type before calling DWARF() and skip the call for plan9 files."],"exampleFix":"// before\nentry, _ := objfile.Open(plan9Bin)\ndata, err := entry.DWARF() // \"no DWARF data in Plan 9 file\"\n\n// after: branch on arch/filetype and use gosym instead\ndata, err := entry.DWARF()\nif err != nil {\n    // fall back to symbol table\n    tbl, _ := entry.PCLineTable()\n}","handlingStrategy":"type-guard","validationCode":"// Detect plan9 binaries before requesting DWARF.\nfunc isPlan9(path string) bool {\n    f, err := os.Open(path)\n    if err != nil { return false }\n    defer f.Close()\n    magic := make([]byte, 4)\n    io.ReadFull(f, magic)\n    // plan9 magics: 0x0000eb00, etc. — use debug/plan9obj for robustness\n    _, err = plan9obj.NewFile(f)\n    return err == nil\n}","typeGuard":"func isNoDWARFPlan9(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"no DWARF data in Plan 9\")\n}","tryCatchPattern":"data, err := entry.DWARF()\nif err != nil && strings.Contains(err.Error(), \"no DWARF data in Plan 9\") {\n    // degrade to Plan 9 symbol table\n    return nil\n}","preventionTips":["Detect GOOS/filetype before calling DWARF().","For Plan 9 targets, plan a symbol-table fallback instead of DWARF.","Cross-check that the target format is expected to carry DWARF."],"tags":["dwarf","plan9","debugging","pprof","go-toolchain"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}