coredump: add COREDUMP_CODE field for signal reason
Introduce COREDUMP_CODE as a new captured field alongside the existing
COREDUMP_SIGNAL. While COREDUMP_SIGNAL identifies the signal number that
terminated the process, COREDUMP_CODE provides the reason the signal was sent.
For example, a process terminated by SIGSEGV due to invalid permissions would
produce COREDUMP_SIGNAL=11 and COREDUMP_CODE=2 (SEGV_ACCERR).
The kernel exposes coredump_code via pidfd starting with v7.1:
https://git.kernel.org/torvalds/c/
701f7f4fbabbf4989ba6fbf033b160dd943221d5
System administrators can find both the signal and code in coredumpctl info:
$ coredumpctl info | grep Signal:
Signal: 11 (SEGV) si_code: SEGV_MAPERR
Signed-off-by: Emanuele Rocca <emanuele.rocca@arm.com>