{"record":{"id":"6cc5b2bb3981c8fc","repo":"go-delve/delve","slug":"reading-nt-prstatus-v","errorCode":null,"errorMessage":"reading NT_PRSTATUS: %v","messagePattern":"reading NT_PRSTATUS: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/linux_core.go","lineNumber":339,"sourceCode":"\t\treturn nil, fmt.Errorf(\"reading desc: %v\", err)\n\t}\n\tdescReader := bytes.NewReader(desc)\n\tswitch note.Type {\n\tcase elf.NT_PRSTATUS:\n\t\tswitch machineType {\n\t\tcase _EM_X86_64:\n\t\t\tnote.Desc = &linuxPrStatusAMD64{}\n\t\tcase _EM_AARCH64:\n\t\t\tnote.Desc = &linuxPrStatusARM64{}\n\t\tcase _EM_RISCV:\n\t\t\tnote.Desc = &linuxPrStatusRISCV64{}\n\t\tcase _EM_LOONGARCH:\n\t\t\tnote.Desc = &linuxPrStatusLOONG64{}\n\t\tdefault:\n\t\t\treturn nil, errors.New(\"unsupported machine type\")\n\t\t}\n\t\tif err := binary.Read(descReader, binary.LittleEndian, note.Desc); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading NT_PRSTATUS: %v\", err)\n\t\t}\n\tcase elf.NT_PRPSINFO:\n\t\tnote.Desc = &linuxPrPsInfo{}\n\t\tif err := binary.Read(descReader, binary.LittleEndian, note.Desc); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading NT_PRPSINFO: %v\", err)\n\t\t}\n\tcase _NT_FILE:\n\t\t// No good documentation reference, but the structure is\n\t\t// simply a header, including entry count, followed by that\n\t\t// many entries, and then the file name of each entry,\n\t\t// null-delimited. Not reading the names here.\n\t\tdata := &linuxNTFile{}\n\t\tif err := binary.Read(descReader, binary.LittleEndian, &data.linuxNTFileHdr); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading NT_FILE header: %v\", err)\n\t\t}\n\t\tfor i := 0; i < int(data.Count); i++ {\n\t\t\tentry := &linuxNTFileEntry{}\n\t\t\tif err := binary.Read(descReader, binary.LittleEndian, entry); err != nil {","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/linux_core.go#L321-L357","documentation":"This error occurs when binary.Read fails to decode the NT_PRSTATUS note descriptor into the architecture-specific linuxPrStatus struct (registers, signal, PID, etc.) for the core's machine type. It usually means the descriptor is shorter than the expected struct size, i.e. the core is truncated or produced by an incompatible kernel/architecture layout.","triggerScenarios":"Parsing a core file whose NT_PRSTATUS descriptor has fewer bytes than the struct (linuxPrStatusAMD64/linuxPrStatusARM64/.../linuxPrStatusLOONG64) requires; corrupted or mixed-endianness core files also fail here.","commonSituations":"Opening an arm64 or loong64 core on a build whose struct layout doesn't match the producing kernel, truncated dumps, or cores generated on other machines with mismatched architecture vs. the ELF machine type recorded.","solutions":["Confirm the core's architecture matches the binary you pass to dlv core (file <core>, readelf -h <core>).","Re-capture the core dump; verify with readelf -n <core> that NT_PRSTATUS is present and intact.","Ensure Delve supports the core's machine type (x86_64, arm64, i386, ppc64le, riscv64, loong64); unsupported pairs fail earlier with 'unsupported machine type'.","Check that the core was produced by a Linux kernel using the standard ELF PrStatus layout for that architecture."],"exampleFix":"// before\ncmd := exec.Command(\"dlv\", \"core\", amd64Binary, arm64Core) // arch mismatch\n// after\ncoreArch := readELFMachine(arm64Core) // e.g. via readelf -h\nbinArch := readELFMachine(amd64Binary)\nif coreArch != binArch {\n    return fmt.Errorf(\"architecture mismatch: core is %s, binary is %s\", coreArch, binArch)\n}","handlingStrategy":"validation","validationCode":"// Ensure core and binary architectures match before debugging:\nfunc archMatches(corePath, binPath string) (bool, error) {\n    for _, p := range []string{corePath, binPath} {\n        f, err := os.Open(p)\n        if err != nil { return false, err }\n        ef, err := elf.NewFile(f)\n        f.Close()\n        if err != nil { return false, fmt.Errorf(\"%s: %w\", p, err) }\n        _ = ef.Machine\n    }\n    return elfMachine(corePath) == elfMachine(binPath), nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always debug cores against the exact binary (same GOARCH) that crashed.","Check `file <core>` reports the expected architecture first.","Avoid copying cores across architectures without noting which machine produced them.","Pin core capture and analysis to matching Delve builds for loong64/ppc64le/riscv64."],"tags":["core-dump","elf","binary-decoding","architecture"],"backgroundTag":"core-note-decode-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}