Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado.foss@gmail.com>
To: gdb-patches@sourceware.org
Cc: thiago.bauermann@linaro.org
Subject: [PATCH 0/2] gdb, aarch64: cache pointer authentication masks per inferior
Date: Sat, 12 Sep 2026 23:20:09 +0100	[thread overview]
Message-ID: <20260912222011.2395686-1-luis.machado.foss@gmail.com> (raw)

aarch64_remove_non_address_bits recomputes the pointer authentication
dmask/cmask on every call by walking the current inferior's thread
list, looking up its regcache, and reading the masks from the target.
This function is called from memory_xfer_partial for every memory
transfer GDB performs, as well as from the watchpoint and breakpoint
address-masking hooks, so the lookup happens far more often than the
masks can possibly change (they are fixed for the life of a process
and shared by all of its threads).

Patch 1 caches the computed mask per inferior instead of recomputing
it on every call, only populating the cache when a thread is stopped
so a transient "thread running" state never gets cached as a
permanent answer, and invalidates the cache on inferior exit,
inferior appeared, and exec.

Patch 2 adds a selftest that verifies the cache actually avoids
redundant target register fetches across a simulated resume/stop
cycle.

Tested on aarch64-linux with no regressions, though the testing was
done on a target without PAC support. It would be good to also
validate on a PAC-enabled target to be sure.

Luis Machado (2):
  gdb, aarch64: cache pointer authentication masks per inferior
  gdb, aarch64: add selftest for the pauth mask cache

 gdb/aarch64-tdep.c | 224 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 182 insertions(+), 42 deletions(-)

-- 
2.43.0


             reply	other threads:[~2026-09-12 22:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 22:20 Luis Machado [this message]
2026-09-12 22:20 ` [PATCH 1/2] " Luis Machado
2026-09-14 15:24   ` Simon Marchi
2026-09-12 22:20 ` [PATCH 2/2] gdb, aarch64: add selftest for the pauth mask cache Luis Machado

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=20260912222011.2395686-1-luis.machado.foss@gmail.com \
    --to=luis.machado.foss@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=thiago.bauermann@linaro.org \
    /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