Open
Description
Description
The crash handler will report the program faulted at si_addr, however si_addr is not filled for all signals, for example, SIGQUIT, SIGABORT. This leads to reporting a misleading message where the address is not valid.
crashInfo.fault_address = (uint64_t)pinfo->si_addr;
According to POSIX si_addr may be filled for SIGILL, SIGFPE, SIGSEGV and SIGBUS
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/signal.h.html
For some implementations, the value of si_addr may be inaccurate.
Reproduction
$ cat abort.swift
import Glibc
abort()
$ ./abort
💣 Program crashed: Aborted at 0x3a07e15300047ea1
Thread 0 "abort" crashed:
0 0x00007f436bb4b9fc pthread_kill@@GLIBC_2.34 + 300 in libc.so.6
where 0x3a07e15300047ea1
is not a valid instruction.
Expected behavior
Not printing a misleading fault address. Perhaps the pc could be read from the ucontext
Environment
$ swiftc -v
Swift version 6.2-dev (LLVM 2e7485f44847d34, Swift 1e96466)
Additional information
No response