diff options
author | Christina Schimpe <christina.schimpe@intel.com> | 2022-12-15 08:50:21 +0100 |
---|---|---|
committer | Schimpe, Christina <christina.schimpe@intel.com> | 2024-11-18 13:35:52 +0000 |
commit | 86bb38cee9399c4092e6fc5f280d296fab7e3327 (patch) | |
tree | 14b8b3182dd8f6404e429db18a25ff03f52af62a /gdb/gdbarch_components.py | |
parent | 335cb88259f60a50b96da84c90559ec6a149eb04 (diff) | |
download | gdb-86bb38cee9399c4092e6fc5f280d296fab7e3327.zip gdb-86bb38cee9399c4092e6fc5f280d296fab7e3327.tar.gz gdb-86bb38cee9399c4092e6fc5f280d296fab7e3327.tar.bz2 |
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>
Diffstat (limited to 'gdb/gdbarch_components.py')
-rw-r--r-- | gdb/gdbarch_components.py | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index 4006380..cc7c6d8 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -1232,18 +1232,55 @@ possible it should be in TARGET_READ_PC instead). Method( comment=""" On some architectures, not all bits of a pointer are significant. -On AArch64, for example, the top bits of a pointer may carry a "tag", which -can be ignored by the kernel and the hardware. The "tag" can be regarded as -additional data associated with the pointer, but it is not part of the address. +On AArch64 and amd64, for example, the top bits of a pointer may carry a +"tag", which can be ignored by the kernel and the hardware. The "tag" can be +regarded as additional data associated with the pointer, but it is not part +of the address. Given a pointer for the architecture, this hook removes all the -non-significant bits and sign-extends things as needed. It gets used to remove -non-address bits from data pointers (for example, removing the AArch64 MTE tag -bits from a pointer) and from code pointers (removing the AArch64 PAC signature -from a pointer containing the return address). +non-significant bits and sign-extends things as needed. It gets used to +remove non-address bits from pointers used for watchpoints. """, type="CORE_ADDR", - name="remove_non_address_bits", + name="remove_non_address_bits_watchpoint", + params=[("CORE_ADDR", "pointer")], + predefault="default_remove_non_address_bits", + invalid=False, +) + +Method( + comment=""" +On some architectures, not all bits of a pointer are significant. +On AArch64 and amd64, for example, the top bits of a pointer may carry a +"tag", which can be ignored by the kernel and the hardware. The "tag" can be +regarded as additional data associated with the pointer, but it is not part +of the address. + +Given a pointer for the architecture, this hook removes all the +non-significant bits and sign-extends things as needed. It gets used to +remove non-address bits from pointers used for breakpoints. +""", + type="CORE_ADDR", + name="remove_non_address_bits_breakpoint", + params=[("CORE_ADDR", "pointer")], + predefault="default_remove_non_address_bits", + invalid=False, +) + +Method( + comment=""" +On some architectures, not all bits of a pointer are significant. +On AArch64 and amd64, for example, the top bits of a pointer may carry a +"tag", which can be ignored by the kernel and the hardware. The "tag" can be +regarded as additional data associated with the pointer, but it is not part +of the address. + +Given a pointer for the architecture, this hook removes all the +non-significant bits and sign-extends things as needed. It gets used to +remove non-address bits from any pointer used to access memory. +""", + type="CORE_ADDR", + name="remove_non_address_bits_memory", params=[("CORE_ADDR", "pointer")], predefault="default_remove_non_address_bits", invalid=False, |