Re: [PATCH v1 09/10] gdb/linux-tdep: parse ProtectionKey in /proc/PID/smaps

Yury Khrustalev <[email protected]> Mon, 27 Jul 2026 09:22:42 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On Sat, Jul 25, 2026 at 06:40:33AM +0000, Thiago Jung Bauermann wrote:
> Yury Khrustalev <[email protected]> writes:
> 
> ...
>
> >> > The look-up of those overlay permissions is platform-specific).
> >> 
> >> Considering that there are differences in how protection keys are
> >> implemented in different architectures (e.g., IIUC only Arm has overlay
> >> permissions), the whole "effective: r-- overlay: r--" part of the line
> >> should be printed by a gdbarch hook.
> >> 
> >> > If no protection key support exists on the target, the PKey column would not be printed.
> >> > Same for the threads' permissions (effective and overlay).
> >> 
> >> Also even if protection key support is available, if there's no
> >> protection key set for any mapping then the column shouldn't be printed
> >> either. Or is there always a key associated with every mapping?
> >
> > I think the column should be just empty or have some placeholder like a
> > hyphen when mapping is not associated with a pkey.
> 
> I don't see much use for an empty column (or one containing only
> placeholder values), but I also don't feel strongly about it.

The point of the empty column (that is only shown when pkeys are
supported) is that it would show that none of your mappings use any
pkeys. I think this is useful piece of information. E.g. if I expect to
see a key but due to a bug it's not used, I don't want to not see this
column at all because I would think that my version of GDB does not
support it or something.