{"record":{"id":"f2712bb3d4c9aeb1","repo":"go-delve/delve","slug":"software-exception","errorCode":null,"errorMessage":"software exception","messagePattern":"software exception","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/gdbserial/gdbserver.go","lineNumber":2233,"sourceCode":"}\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\n\t// process isn't. In this condition debugserver will crash.\n\tout, err := exec.Command(\"uname\", \"-m\").Output()","sourceCodeStart":2215,"sourceCodeEnd":2251,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/gdbserial/gdbserver.go#L2215-L2251","documentation":"This error comes from machTargetExcToError, which maps Mach exception codes reported by debugserver/lldb-server (on macOS) into Go errors. Mach exception 0x95 (EXC_SOFTWARE) means the target process raised a software-generated exception that is not a breakpoint or arithmetic fault. Delve surfaces it as a stop reason so the user knows the debuggee hit an abnormal condition.","triggerScenarios":"Debugging a Go program on macOS via the gdbserial backend (debugserver/lldb-server); the process receives a Mach EXC_SOFTWARE (0x95) during resume/single-step, e.g. from an explicit software abort or unsupported instruction trap.","commonSituations":"Debugging on macOS when the target hits a software trap not recognized as a breakpoint (e.g. deliberate EXC_SOFT_SIGNAL, unusual runtime traps); running under mismatched tooling or on architectures where instructions fault as EXC_SOFTWARE; attaching to processes that raise software exceptions intentionally.","solutions":["Inspect the goroutine/thread state and stack at the stop to find which instruction or runtime call raised the exception","Check whether the binary was built for the correct GOARCH/OS matching the host (avoid Rosetta-translated binaries)","If the exception is intentional (e.g. signal via software exception), handle or filter it in the debugger session","Update debugserver/Xcode command line tools; older debugserver versions report spurious Mach exceptions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := dlvTrace(ctx); err != nil {\n    if strings.Contains(err.Error(), \"software exception\") {\n        // inspect stop state: which thread/goroutine, current instruction\n        log.Printf(\"target raised EXC_SOFTWARE: %v\", err)\n    }\n}","preventionTips":["Build the debuggee for the native macOS architecture (avoid Rosetta-translated binaries)","Keep debugserver/Xcode CLT up to date","Avoid running multiple debuggers on the same process"],"tags":["gdbserial","macos","mach-exception","debugger"],"backgroundTag":"mach-exception-stop","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}