gdb: align siginfo_t with the Linux kernel definition
GDB's current definition of siginfo_t is missing many fields present in
the Linux kernel definition [1].
These fields are useful for providing detailed, user-friendly diagnostics
when a fault occurs. Some new AArch64 extensions, such as Permission
Overlay Enhancement used to implement Protection Keys [2], require the
debugger to inspect 'si_pkey' alongside 'si_addr' to help the user identify
the problematic key.
This patch aligns GDB's definition of the __sifields._sigfault member of
siginfo_t with the definition from the Linux kernel master branch.
To avoid hardcoding the field access paths throughout the codebase, this
patch also introduces compile-time accessors for the siginfo_t attributes,
centralizing their definitions in a single location and making future
updates easier.
Finally, extend the testsuite to verify access to the new si_pkey field
and its preservation when modifying $_siginfo and when reading core files.
The tests in siginfo-obj.exp rely on the siginfo_t definition provided by
glibc's <signal.h>, which does not yet expose all of the fields present in
the kernel definition. As a result, the tests cannot exercise every newly
added field and therefore focus on si_pkey, the field motivating this change.
The test validates that GDB can read and modify the field correctly; it does
not attempt to generate a real protection-key fault.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
tree/include/uapi/asm-generic/siginfo.h#n69
[2]: https://lore.kernel.org/all/20160212210213.ABC488FA@viggo.jf.intel.com/
Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 files changed