I know that:
When installing a
SIGSEGVsignal handler withsigactionand asa_sigaction(rather thansa_handler), the signal handler receives asiginfo_t*, of which thesi_addris the address at which the fault occurred.Using the
ucontext_twe can inspect the values of registers, for example the instruction pointer, albeit not in a platform-independent way (Linux signal handling. How to get address of interrupted instruction?).
My question: can we also know which register caused the fault? Given that we don't have memory-to-memory moves, this should be only one register (after all, there is also only a single si_addr). Of course I could inspect all registers and search for si_addr, but there may be more than one match.
I would be perfectly happy with solutions that are not platform-independent.