{"record":{"id":"11b7bd99c0a47083","repo":"go-delve/delve","slug":"emulation-exception","errorCode":null,"errorMessage":"emulation exception","messagePattern":"emulation exception","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver.go","lineNumber":2231,"sourceCode":"\tcopy(savedRegs.loaded, regs.loaded)\n\treturn savedRegs, nil\n}\n\nfunc registerName(arch *proc.Arch, regNum uint64) string {\n\tregName, _, _ := arch.DwarfRegisterToString(int(regNum), nil)\n\treturn strings.ToLower(regName)\n}\n\nfunc machTargetExcToError(sig uint8) error {\n\tswitch sig {\n\tcase 0x91:\n\t\treturn errors.New(\"bad access\")\n\tcase 0x92:\n\t\treturn errors.New(\"bad instruction\")\n\tcase 0x93:\n\t\treturn errors.New(\"arithmetic exception\")\n\tcase 0x94:\n\t\treturn errors.New(\"emulation exception\")\n\tcase 0x95:\n\t\treturn errors.New(\"software exception\")\n\tcase 0x96:\n\t\treturn errors.New(\"breakpoint exception\")\n\t}\n\treturn nil\n}\n\nfunc checkRosettaExpensive() error {\n\tif runtime.GOOS != \"darwin\" {\n\t\treturn nil\n\t}\n\tif runtime.GOARCH != \"arm64\" {\n\t\treturn nil\n\t}\n\n\t// Additionally check the output of 'uname -m' if it's x86_64 it means that\n\t// the shell we are running on is being emulated by Rosetta even though our","sourceCodeStart":2213,"sourceCodeEnd":2249,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver.go#L2213-L2249","documentation":"machTargetExcToError maps Mach exception 0x94 (EXC_EMULATION) to 'emulation exception', meaning an instruction required emulator assistance that failed (equivalent of SIGEMUL).","triggerScenarios":"Target triggers an emulation fault on macOS; the stub reports Mach exception 0x94 and delve converts it into this error.","commonSituations":"Rare; seen with unusual instructions, binary translation layers (Rosetta), or kernels failing to emulate a legacy instruction.","solutions":["Check whether you're running under Rosetta or another translation layer and test a native build.","Disassemble at PC to identify the faulting instruction.","Rebuild/upgrade dependencies that may emit obsolete instructions.","If persistent, report to delve/Apple with the wire log and disassembly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"emulation exception\") {\n    // check for translation-layer (Rosetta) issues\n}","preventionTips":["Test natively instead of under Rosetta/emulation when this appears.","Disassemble at PC to find the non-emulatable instruction.","Upgrade toolchains/binaries that may emit legacy instructions."],"tags":["macos","mach-exception","emulation","gdbserial"],"backgroundTag":"emulation-exception","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}