go-delve/delve · error
unsupported pointer size %d
Error message
unsupported pointer size %d
What it means
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.
Source
Thrown at pkg/proc/fncall.go:471
return "panic calling a function"
}
func fncallLog(fmtstr string, args ...any) {
logflags.FnCallLogger().Infof(fmtstr, args...)
}
// writePointer writes val as an architecture pointer at addr in mem.
func writePointer(bi *BinaryInfo, mem MemoryReadWriter, addr, val uint64) error {
ptrbuf := make([]byte, bi.Arch.PtrSize())
// TODO: use target architecture endianness instead of LittleEndian
switch len(ptrbuf) {
case 4:
binary.LittleEndian.PutUint32(ptrbuf, uint32(val))
case 8:
binary.LittleEndian.PutUint64(ptrbuf, val)
default:
panic(fmt.Errorf("unsupported pointer size %d", len(ptrbuf)))
}
_, err := mem.WriteMemory(addr, ptrbuf)
return err
}
// callOP simulates a call instruction on the given thread:
// * pushes the current value of PC on the stack (adjusting SP)
// * changes the value of PC to callAddr
// Note: regs are NOT updated!
func callOP(bi *BinaryInfo, thread Thread, regs Registers, callAddr uint64) error {
switch bi.Arch.Name {
case "amd64":
sp := regs.SP()
// push PC on the stack
sp -= uint64(bi.Arch.PtrSize())
if err := setSP(thread, sp); err != nil {
return err
}View on GitHub (pinned to a23773e6c3)
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
Example fix
// before
panic(fmt.Errorf("unsupported pointer size %d", len(ptrbuf)))
// after
if len(ptrbuf) != 4 && len(ptrbuf) != 8 { return fmt.Errorf("unsupported pointer size %d", len(ptrbuf)) } Defensive patterns
Strategy: validation
Validate before calling
if bi.Arch.PtrSize() != 4 && bi.Arch.PtrSize() != 8 {
return fmt.Errorf("call injection unsupported on ptr size %d", bi.Arch.PtrSize())
} Prevention
- Only run call injection on officially supported GOARCH values
- Check bi.Arch before starting call-injection workflows
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- internal debugger error: eval program finished without error
- internal debugger error: could not undo injected call during
- expression %q is not a function
- could not find DIE for function %q
- cannot use %s as argument %s in function %s: stack object pa
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/59785249182b66d7.
Report an issue: GitHub.