{"record":{"id":"787e74fd0833353a","repo":"go-delve/delve","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/proc/native/threads_darwin.go","lineNumber":134,"sourceCode":"\t}\n\tif len(buf) == 0 {\n\t\treturn 0, nil\n\t}\n\tvar (\n\t\tvmData = unsafe.Pointer(&buf[0])\n\t\tvmAddr = C.mach_vm_address_t(addr)\n\t\tlength = C.mach_msg_type_number_t(len(buf))\n\t)\n\n\tret := C.read_memory(t.dbp.os.task, vmAddr, vmData, length)\n\tif ret < 0 {\n\t\treturn 0, fmt.Errorf(\"could not read memory\")\n\t}\n\treturn len(buf), nil\n}\n\nfunc (t *nativeThread) restoreRegisters(sr proc.Registers) error {\n\treturn errors.New(\"not implemented\")\n}\n\nfunc (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error {\n\treturn proc.ErrHWBreakUnsupported\n}\n\n// SoftExc returns true if this thread received a software exception during the last resume.\nfunc (t *nativeThread) SoftExc() bool {\n\treturn false\n}\n","sourceCodeStart":116,"sourceCodeEnd":145,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/threads_darwin.go#L116-L145","documentation":"restoreRegisters on the darwin native backend is unimplemented: the darwin port cannot write saved register state back into a thread. Any code path that needs to restore registers (e.g. hot-swapping register state after register modification, or certain replay/call-injection features) fails with this error.","triggerScenarios":"Calling restoreRegisters on a darwin native thread — reached when delve operations need to push modified register state back, such as applying edited registers or certain function-call simulation paths.","commonSituations":"Using features that modify registers on macOS (some `regs --set`, call injection scenarios); running darwin-specific backends that lag behind linux feature parity.","solutions":["Avoid features requiring register restoration on macOS; use breakpoint/step-based workflows instead.","Update/patch delve: implement restoreRegisters using thread_set_state on the mach thread act.","Perform register modifications on a platform that supports them (linux/windows) if possible.","If you only need to read registers, use `regs` without write flags — reading is supported."],"exampleFix":"// before\nfunc (t *nativeThread) restoreRegisters(sr proc.Registers) error {\n\treturn errors.New(\"not implemented\")\n}\n// after\nfunc (t *nativeThread) restoreRegisters(sr proc.Registers) error {\n\tr := sr.(*darwinRegisters)\n\tkret := C.thread_set_state(C.thread_act_t(t.os.threadAct), C.x86_THREAD_STATE64,\n\t\t(*C.int)(unsafe.Pointer(&r.regs)), C.x86_THREAD_STATE64_COUNT)\n\tif kret != C.KERN_SUCCESS {\n\t\treturn fmt.Errorf(\"thread_set_state failed: %d\", kret)\n\t}\n\treturn nil\n}","handlingStrategy":"fallback","validationCode":"// detect darwin backend before using register-restore features\nif runtime.GOOS == \"darwin\" {\n\t// avoid flows that modify/restore registers\n}","typeGuard":"func isNotImplementedErr(err error) bool {\n\treturn err != nil && (err.Error() == \"not implemented\" || errors.Is(err, proc.ErrNotImplemented))\n}","tryCatchPattern":"if err := thread.RestoreRegisters(saved); err != nil {\n\tif err.Error() == \"not implemented\" {\n\t\t// degrade: re-launch process with fresh state instead of restoring\n\t\treturn relaunchAndReapplyBreakpoints()\n\t}\n\treturn err\n}","preventionTips":["Avoid register-modification features on macOS; use them on linux.","Check backend capability (SupportsFeature/capability APIs) before register writes.","Keep darwin backend patched if you need restoreRegisters upstream.","Design workflows to survive full process restart instead of register restore."],"tags":["macos","registers","unimplemented","debugging"],"backgroundTag":"not-implemented-on-platform","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}