]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[AArch64] MTE corefile support
authorLuis Machado <luis.machado@arm.com>
Thu, 31 Mar 2022 10:42:35 +0000 (11:42 +0100)
committerLuis Machado <luis.machado@arm.com>
Tue, 19 Jul 2022 14:24:31 +0000 (15:24 +0100)
commit68cffbbd4406b4efe1aa6e18460b1d7ca02549f1
treef8a61526011db5bf0c60314f38de6fc48cd82ca0
parentd0ff5ca959df91dcef16ec57154ff199fad5a4e4
[AArch64] MTE corefile support

Teach GDB how to dump memory tags for AArch64 when using the gcore command
and how to read memory tag data back from a core file generated by GDB
(via gcore) or by the Linux kernel.

The format is documented in the Linux Kernel documentation [1].

Each tagged memory range (listed in /proc/<pid>/smaps) gets dumped to its
own PT_AARCH64_MEMTAG_MTE segment. A section named ".memtag" is created for each
of those segments when reading the core file back.

To save a little bit of space, given MTE tags only take 4 bits, the memory tags
are stored packed as 2 tags per byte.

When reading the data back, the tags are unpacked.

I've added a new testcase to exercise the feature.

Build-tested with --enable-targets=all and regression tested on aarch64-linux
Ubuntu 20.04.

[1] Documentation/arm64/memory-tagging-extension.rst (Core Dump Support)
17 files changed:
gdb/Makefile.in
gdb/NEWS
gdb/aarch64-linux-tdep.c
gdb/arch/aarch64-mte-linux.c
gdb/arch/aarch64-mte-linux.h
gdb/corelow.c
gdb/defs.h
gdb/doc/gdb.texinfo
gdb/gcore.c
gdb/gdbarch-components.py
gdb/gdbarch-gen.h
gdb/gdbarch.c
gdb/linux-tdep.c
gdb/memtag.c [new file with mode: 0644]
gdb/memtag.h [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-mte-core.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-mte-core.exp [new file with mode: 0644]