# orca.crash

> A module of morca's API.

What a crash left in a run's output: the stack dump Mojo's runtime prints on a fatal signal (a segfault, `abort`, a failed bounds check), cut down to a line for the error of the attempt it ended.

A dump's frames read `#<n> 0x<address> <function> <file>:<line>:<col>` when
the runtime finds `llvm-symbolizer` (`LLVM_SYMBOLIZER_PATH`, which the
project image sets, else `PATH`) and the binary has line tables (`mojo
build -g1`, as the image builds it). Without the symbolizer the dump starts
`Stack dump without symbol names` and its frames are addresses. A line
`ABORT: ...` or `At: ...: Assert Error: ...` just before the frames is what
`abort` or a failed `debug_assert` said.

The runners call `crash_summary` on the output of a start that ended: the
local runner when it reaps the process (`orca.scheduler`), the ec2 runner's
`keep-log` on the head (`orca.ec2`), and the Kubernetes runner as it keeps
the driver pod's log (`orca.kube`); each marks the attempts the process
left `running` as failed with it.

## Functions

### `crash_summary`

```mojo
def crash_summary(output: String) -> String
```

`crashed: <message>; at <function> <file:line>, ...` for the last stack dump in `output` after its last `--- start` line (the runners mark each start so), or empty if there's none. The frames named are the first with a line number outside Mojo's standard library.

### `crashed_by_signal`

```mojo
def crashed_by_signal(code: Int) -> Bool
```

Whether an exit code (128 + the signal for a process a signal killed) is a crash's: SIGILL, SIGTRAP, SIGABRT, SIGBUS (7 on Linux, 10 on macOS), SIGFPE or SIGSEGV, not a kill or an interrupt.
