Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Matthieu Longo <matthieu.longo@arm.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Andrew Burgess <aburgess@redhat.com>,
	Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Subject: Re: [PATCH v1] gdb: align siginfo_t with the Linux kernel definition
Date: Fri, 12 Jun 2026 11:42:45 +0100	[thread overview]
Message-ID: <63fce133-4d28-4629-9a60-6d14cba49b86@arm.com> (raw)
In-Reply-To: <20260612101610.592338-1-matthieu.longo@arm.com>

On 12/06/2026 11:16, Matthieu Longo wrote:
> 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.
> 
> [1]: https://github.com/torvalds/linux/blob/2b414a95b8f7307d42173ba9e580d6
>       d3e2bcbfce/include/uapi/asm-generic/siginfo.h#L69-L100
> [2]: https://lore.kernel.org/all/20160212210213.ABC488FA@viggo.jf.intel.com/
> ---
>   gdb/linux-tdep.c | 39 +++++++++++++++++++++++++++++++++++++--
>   1 file changed, 37 insertions(+), 2 deletions(-)
> 
I was not sure who I should include for the review. Please feel free to CC the right persons if they 
are not already in the list.

I tested the patch above, and it seems to work fine without any change in ./gdb/nat
However, in my understanding, compat_siginfo_t should also be impacted. Why is it still working then 
without any change ?

(gdb) print $_siginfo
$2 = {
   si_signo = 4,
   si_errno = 0,
   si_code = 12,
   _sifields = {
     _pad = {4327056, 0, 0, 1, 0 <repeats 24 times>},
     _kill = {
       si_pid = 4327056,
       si_uid = 0
     },
     _timer = {
       si_tid = 4327056,
       si_overrun = 0,
       si_sigval = {
         sival_int = 0,
         sival_ptr = 0x100000000
       }
     },
     _rt = {
       si_pid = 4327056,
       si_uid = 0,
       si_sigval = {
         sival_int = 0,
         sival_ptr = 0x100000000
       }
     },
     _sigchld = {
       si_pid = 4327056,
       si_uid = 0,
       si_status = 0,
       si_utime = 1,
       si_stime = 0
     },
     _sigfault = {
       si_addr = 0x420690 <tchangef(int)+16>,
       _ = {
         si_trapno = 0,
         si_addr_lsb = 0,
         _addr_bnd = {
           _dummy_bnd = 0,
           si_lower = 0x10000,
           si_upper = 0x0
         },
         _addr_pkey = {
           _dummy_pkey = 0,
           si_pkey = 65536
         },
         _perf = {
           si_perf_data = 4294967296,
           si_perf_type = 0,
           si_perf_flags = 0
         },
         _tchange = {
           si_tchange_target = 0,
           si_tchange_type = 1,
           si_tchange_flags = 0
         }
--Type <RET> for more, q to quit, c to continue without paging--

Note: this dump contains more fields than the Linux kernel master because it has some unmerged patch 
series on top of it. Please don't pay attention to it. That's just for the example.

aarch64_siginfo_from_compat_siginfo (in gdb/nat/aarch64-linux.c) and its friends for each backend 
seem to provide some conversion logic between the siginfo_t from the system 
(/usr/include/asm-generic/siginfo.h) and some internal representation compat_siginfo_t.
 From my research, this seems needed because, if the host and target systems are not using the same 
ABI (endianness, size of a pointer or int, etc...), GDB cannot rely on the local definition of 
siginfo_t to interpret correctly the data in the blob that it received from the target.

However, I am confused by the definition of compat_siginfo_t in gdb/nat/aarch64-linux.h for 
instance. I see that addresses like _sigfaul._addr are converted to 'unsigned int' (that should be 
equivalent to uint32_t I guess). Why is this working ?

Please, could you provide explanations on the above, and guidances on the changes required in struct 
compat_siginfo_t ?

Matthieu

  reply	other threads:[~2026-06-12 10:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 10:16 Matthieu Longo
2026-06-12 10:42 ` Matthieu Longo [this message]
2026-06-17  6:07   ` Thiago Jung Bauermann
2026-06-17  9:11     ` Matthieu Longo
2026-06-18  3:02       ` Thiago Jung Bauermann
2026-06-18 14:02         ` Matthieu Longo
2026-06-18 16:23           ` Thiago Jung Bauermann
2026-06-19  3:58 ` Thiago Jung Bauermann
2026-06-19 10:45   ` Matthieu Longo
2026-06-22  8:42     ` Matthieu Longo
2026-06-24 21:45       ` Thiago Jung Bauermann
2026-06-25  9:55         ` Matthieu Longo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63fce133-4d28-4629-9a60-6d14cba49b86@arm.com \
    --to=matthieu.longo@arm.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox