<!--
{
  "documentType" : "article",
  "framework" : "Xcode",
  "identifier" : "/documentation/Xcode/SIGTRAP_SIGILL",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "EXC_BREAKPOINT (SIGTRAP) and EXC_BAD_INSTRUCTION (SIGILL)"
}
-->

# EXC_BREAKPOINT (SIGTRAP) and EXC_BAD_INSTRUCTION (SIGILL)

A trace trap or invalid CPU instruction interrupted the process,
often because the process violated a requirement or timeout.

## Discussion

A trace trap gives an attached debugger the chance to interrupt the process at a specific
point in its execution. On ARM processors, this appears as `EXC_BREAKPOINT (SIGTRAP). `On `x86_64` processors, this appears as `EXC_BAD_INSTRUCTION (SIGILL)`.

The Swift runtime uses trace traps for specific types of unrecoverable errors—see
[Addressing crashes from Swift runtime errors](/documentation/Xcode/addressing-crashes-from-swift-runtime-errors) for information on those errors.
Some lower-level libraries, such as <doc://com.apple.documentation/documentation/Dispatch>,
trap the process with this exception upon encountering an unrecoverable error, and
log additional information about the error in the `Additional Diagnostic Information`
section of the crash report. See [Diagnostic messages](/documentation/Xcode/examining-the-fields-in-a-crash-report#Diagnostic-messages)
for information about those messages.

If you want to use the same technique in your own code for unrecoverable errors,
call the <doc://com.apple.documentation/documentation/Swift/fatalError(_:file:line:)> function in Swift,
or the `__builtin_trap()` function in C. These functions allow the system to generate a crash
report with thread backtraces that show how you reached the unrecoverable error.

An illegal CPU instruction means
the program’s executable contains an instruction
that the processor doesn’t implement or can’t execute.
For example, the following program
tries to perform the CPU instruction `0x00000001`,
which isn’t a valid instruction on Apple silicon:

```c
#include <stdint.h>

int main(int argc, char **argv) {
    static const uint32_t sTest[] = {
        0x00000001,
    };
    typedef void (*FuncPtr)(void);
    FuncPtr f = (FuncPtr) sTest;
    f();
    return 0;
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)