go-delve/delve · error

unsupported operating system attempting to find Goroutine on

Error message

unsupported operating system attempting to find Goroutine on Thread

What it means

Delve's gdbserial backend reads the goroutine (G) pointer from thread-local storage by emitting an arch-specific 'mov rcx, gs:/fs:offset' instruction and executing it in the debuggee. This panic fires when the host OS is not one of the supported cases (windows, linux) for which the TLB segment-register encoding is known. It is a hard programming/configuration guard, not a recoverable error.

Source

Thrown at pkg/proc/gdbserial/gdbserver.go:1623

	default:
		return strings.HasPrefix(fn.Name, "syscall.Syscall") || strings.HasPrefix(fn.Name, "syscall.RawSyscall")
	}
}

// loadGInstr returns the correct MOV instruction for the current
// OS/architecture that can be executed to load the address of G from an
// inferior's thread.
func (p *gdbProcess) loadGInstr() ([]byte, error) {
	var op []byte
	switch p.bi.GOOS {
	case "windows", "darwin", "freebsd":
		// mov rcx, QWORD PTR gs:{uint32(off)}
		op = []byte{0x65, 0x48, 0x8b, 0x0c, 0x25}
	case "linux":
		// mov rcx,QWORD PTR fs:{uint32(off)}
		op = []byte{0x64, 0x48, 0x8B, 0x0C, 0x25}
	default:
		panic("unsupported operating system attempting to find Goroutine on Thread")
	}
	offset, err := p.bi.GStructOffset(p.Memory())
	if err != nil {
		return nil, err
	}
	buf := &bytes.Buffer{}
	buf.Write(op)
	binary.Write(buf, binary.LittleEndian, uint32(offset))
	return buf.Bytes(), nil
}

func (p *gdbProcess) MemoryMap() ([]proc.MemoryMapEntry, error) {
	r := []proc.MemoryMapEntry{}
	addr := uint64(0)
	for addr != ^uint64(0) {
		mri, err := p.conn.memoryRegionInfo(addr)
		if err != nil {
			return nil, err

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Run on a supported OS (linux or windows) for amd64, or use the native backend instead of gdbserial
  2. Check go-delve delve version; newer releases may have added your OS to this switch
  3. If porting, add a case for your OS emitting the correct mov rcx, seg:{off} opcode bytes
  4. File/track an upstream issue for OS support
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS != "linux" && runtime.GOOS != "windows" {
    return fmt.Errorf("gdbserial goroutine lookup unsupported on %s", runtime.GOOS)
}

Try / catch

defer func() {
    if r := recover(); r != nil {
        err = fmt.Errorf("goroutine lookup failed: %v", r)
    }
}()

Prevention

When it happens

Trigger: Calling the goroutine-lookup code on a thread while running on an OS other than windows or linux (e.g. freebsd with the gdbserial backend, since amd64 the switch only handles those two).

Common situations: Porting Delve to an unsupported OS, running the gdbserial backend (lldb/rr/macos debugserver) on a platform where GStructOffset/segment-register access was never implemented.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/b96180ce12be3d3c. Report an issue: GitHub.