OS signals and fatal diagnostics
Radlang exceptions and native faults remain separate. try/catch handles
language errors; a real memory fault, native assertion or trap still terminates
the process with its original OS signal. The crash report is diagnostic only.
Fatal faults
Generated programs install handlers for SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT and SIGTRAP. Reports include the available Radlang function/line, fault address for memory faults, and instruction/stack registers on supported Apple and Linux arm64/x86-64 hosts. Use lldb or gdb for a full native backtrace.
radlang: fatal error — SIGSEGV — invalid memory access (null or dangling pointer?)
location: boom() (line 2)
address: 0x0
instruction: 0x1046c064c
stack: 0x16ba76680
Run under lldb or gdb for a full native backtrace.Since 1.40.52 the function and line come from a line table, not from a store
before each statement. The compiler reads the DWARF line program of each
generated object at link time into a table, and the runtime maps the faulting
program counter (or, for an uncaught error, the raising frame’s return
address) to a function and line. Errors thrown and then rethrown keep the line
where they were first raised, so an awaited task’s error reports the task’s
line. A library (.rlc) built before 1.40.52 has no table: a fault or raise
inside it reports its caller’s line until the library is rebuilt. Cross-compiled
targets and links without runtime.a keep the per-statement locations, and
RADLANG_NO_LINE_TABLE=1 or RADLANG_NO_DEBUG_LINES=1 at compile time does
the same; RADLANG_BREADCRUMBS=1 forces them.
Handlers use direct writes instead of stdio or an allocating unwinder. They cannot safely flush buffered application output. A broken stderr pipe must not replace the original fatal signal. An exhausted or damaged process may still be unable to produce a complete report.
Alternate stacks and cached native stack bounds belong to each OS thread. Generated function entry and owned runtime worker entry register them in normal context, preserving an existing alternate stack. Native and coroutine guard faults can therefore be identified without querying stack metadata inside the handler. Native threads that never enter generated code or runtime thread entries do not receive automatic thread registration.
The compiler has its own platform sigaction handlers and preserves Rust’s
existing alternate stack. Fatal compiler reports also retain the original
signal termination.
Process and server behavior
The integer results of sys.cli, sys.spawn, the code of sys.exec’s
ProcOutput, and Process wait/output use ordinary exit codes unchanged, 128 + signal for signaled children, and
-1 for spawn/wait failures. An ordinary exit 137 and SIGKILL’s conventional 137
cannot be distinguished through an integer alone. HTTP supervisor logs include
the signal explicitly. radlang rtest reports a signaled test child in both
quiet and verbose modes and returns failure.
HTTP SIGTERM shutdown uses a self-pipe and preserves the interrupted errno.
Worker-completion writes and blocking child waits retry EINTR. Synchronous
socket polls retry against the original monotonic deadline. Socket and TLS
writes suppress broken-peer SIGPIPE per send/socket where supported; Radlang
does not install a process-wide SIGPIPE ignore policy.
Ordinary SIGINT/SIGTERM dispositions outside the existing server lifecycle are unchanged. SIGKILL and SIGSTOP cannot be caught. Other OS signals retain their existing dispositions; a blanket handler would change valid application and supervisor behavior.
Validation
See the v1.26.1 evidence. Native signal probes disable core files, use disposable child processes and bounded timeouts. Full behavior was exercised on macOS arm64; the Linux code paths require Linux acceptance on that platform.