gdb: Make tagged pointer support configurable.

The gdbarch function gdbarch_remove_non_address_bits adjusts addresses to
enable debugging of programs with tagged pointers on Linux, for instance for
ARM's feature top byte ignore (TBI).
Once the function is implemented for an architecture, it adjusts addresses for
memory access, breakpoints and watchpoints.

Linear address masking (LAM) is Intel's (R) implementation of tagged
pointer support.  It requires certain adaptions to GDB's tagged pointer
support due to the following:
- LAM supports address tagging for data accesses only.  Thus, specifying
  breakpoints on tagged addresses is not a valid use case.
- In contrast to the implementation for ARM's TBI, the Linux kernel supports
  tagged pointers for memory access.

This patch makes GDB's tagged pointer support configurable such that it is
possible to enable the address adjustment for a specific feature only (e.g
memory access, breakpoints or watchpoints).  This way, one can make sure
that addresses are only adjusted when necessary.  In case of LAM, this
avoids unnecessary parsing of the /proc/<pid>/status file to get the
untag mask.

Reviewed-By: Felix Willgerodt <felix.willgerodt@intel.com>
(AArch64) Tested-By: Luis Machado <luis.machado@arm.com>
Approved-By: Luis Machado <luis.machado@arm.com>
This commit is contained in:
Christina Schimpe
2022-12-15 08:50:21 +01:00
committed by Schimpe, Christina
parent 335cb88259
commit 86bb38cee9
9 changed files with 167 additions and 45 deletions

View File

@@ -2313,7 +2313,8 @@ update_watchpoint (struct watchpoint *b, bool reparse)
loc->gdbarch = v->type ()->arch ();
loc->pspace = wp_pspace;
loc->address
= gdbarch_remove_non_address_bits (loc->gdbarch, addr);
= gdbarch_remove_non_address_bits_watchpoint (loc->gdbarch,
addr);
b->add_location (*loc);
if (bitsize != 0)
@@ -7538,7 +7539,7 @@ adjust_breakpoint_address (struct gdbarch *gdbarch,
}
adjusted_bpaddr
= gdbarch_remove_non_address_bits (gdbarch, adjusted_bpaddr);
= gdbarch_remove_non_address_bits_breakpoint (gdbarch, adjusted_bpaddr);
/* An adjusted breakpoint address can significantly alter
a user's expectations. Print a warning if an adjustment