{"record":{"id":"59785249182b66d7","repo":"go-delve/delve","slug":"unsupported-pointer-size-d","errorCode":null,"errorMessage":"unsupported pointer size %d","messagePattern":"unsupported pointer size (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":471,"sourceCode":"\treturn \"panic calling a function\"\n}\n\nfunc fncallLog(fmtstr string, args ...any) {\n\tlogflags.FnCallLogger().Infof(fmtstr, args...)\n}\n\n// writePointer writes val as an architecture pointer at addr in mem.\nfunc writePointer(bi *BinaryInfo, mem MemoryReadWriter, addr, val uint64) error {\n\tptrbuf := make([]byte, bi.Arch.PtrSize())\n\n\t// TODO: use target architecture endianness instead of LittleEndian\n\tswitch len(ptrbuf) {\n\tcase 4:\n\t\tbinary.LittleEndian.PutUint32(ptrbuf, uint32(val))\n\tcase 8:\n\t\tbinary.LittleEndian.PutUint64(ptrbuf, val)\n\tdefault:\n\t\tpanic(fmt.Errorf(\"unsupported pointer size %d\", len(ptrbuf)))\n\t}\n\t_, err := mem.WriteMemory(addr, ptrbuf)\n\treturn err\n}\n\n// callOP simulates a call instruction on the given thread:\n// * pushes the current value of PC on the stack (adjusting SP)\n// * changes the value of PC to callAddr\n// Note: regs are NOT updated!\nfunc callOP(bi *BinaryInfo, thread Thread, regs Registers, callAddr uint64) error {\n\tswitch bi.Arch.Name {\n\tcase \"amd64\":\n\t\tsp := regs.SP()\n\t\t// push PC on the stack\n\t\tsp -= uint64(bi.Arch.PtrSize())\n\t\tif err := setSP(thread, sp); err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L453-L489","documentation":"writePointer panics with this error when the target architecture's pointer size is neither 4 nor 8 bytes. Delve only supports encoding pointers into the inferior's memory for 32-bit and 64-bit targets, so any other ptrbuf length indicates an unsupported or corrupted binary info arch setup. Because it panics rather than returns, it aborts the call-injection machinery mid-injection.","triggerScenarios":"Calling a function (evalCallInjectionStart/callOP/writeString path) on a target whose bi.Arch.PtrSize() returns a value other than 4 or 8, or when the scratch pointer buffer was allocated with an unexpected length.","commonSituations":"Debugging on an exotic/unsupported architecture or a corrupted BinaryInfo where pointer size detection failed; also possible with mixed 32/64-bit mismatch between debugger and inferior.","solutions":["Verify you are running on a supported architecture (386/amd64/arm64/etc. with ptr size 4 or 8)","Rebuild/reload the target so BinaryInfo.Arch is detected correctly","File a bug with the architecture details if ptr size is legitimately 4 or 8"],"exampleFix":"// before\npanic(fmt.Errorf(\"unsupported pointer size %d\", len(ptrbuf)))\n// after\nif len(ptrbuf) != 4 && len(ptrbuf) != 8 { return fmt.Errorf(\"unsupported pointer size %d\", len(ptrbuf)) }","handlingStrategy":"validation","validationCode":"if bi.Arch.PtrSize() != 4 && bi.Arch.PtrSize() != 8 {\n    return fmt.Errorf(\"call injection unsupported on ptr size %d\", bi.Arch.PtrSize())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only run call injection on officially supported GOARCH values","Check bi.Arch before starting call-injection workflows"],"tags":["go","debugger","architecture","call-injection"],"backgroundTag":"unsupported-pointer-size","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}