From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1936) id B00083858010; Tue, 3 May 2022 23:11:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B00083858010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: John Baldwin To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Read the tpidr register from NT_ARM_TLS core dump notes on Linux Aarch64. X-Act-Checkin: binutils-gdb X-Git-Author: John Baldwin X-Git-Refname: refs/heads/master X-Git-Oldrev: b7fe5463cf0dd6d7701d0be5ae129a9d4ecd28bc X-Git-Newrev: 224151d7748ef13df82878067266cfaa9861e360 Message-Id: <20220503231109.B00083858010@sourceware.org> Date: Tue, 3 May 2022 23:11:09 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2022 23:11:09 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D224151d7748e= f13df82878067266cfaa9861e360 commit 224151d7748ef13df82878067266cfaa9861e360 Author: John Baldwin Date: Tue May 3 16:05:10 2022 -0700 Read the tpidr register from NT_ARM_TLS core dump notes on Linux Aarch6= 4. Diff: --- gdb/aarch64-linux-tdep.c | 21 ++++++++++++++++++++- gdb/aarch64-linux-tdep.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 8cfb64d9f4a..dbebcd4f0e0 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -749,6 +749,24 @@ aarch64_linux_iterate_over_regset_sections (struct gdb= arch *gdbarch, AARCH64_LINUX_SIZEOF_MTE_REGSET, &aarch64_linux_mte_regset, "MTE registers", cb_data); } + + if (tdep->has_tls ()) + { + const struct regcache_map_entry tls_regmap[] =3D + { + { 1, tdep->tls_regnum, 8 }, + { 0 } + }; + + const struct regset aarch64_linux_tls_regset =3D + { + tls_regmap, regcache_supply_regset, regcache_collect_regset + }; + + cb (".reg-aarch-tls", AARCH64_LINUX_SIZEOF_TLSREGSET, + AARCH64_LINUX_SIZEOF_TLSREGSET, &aarch64_linux_tls_regset, + "TLS register", cb_data); + } } =20 /* Implement the "core_read_description" gdbarch method. */ @@ -757,13 +775,14 @@ static const struct target_desc * aarch64_linux_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd) { + asection *tls =3D bfd_get_section_by_name (abfd, ".reg-aarch-tls"); CORE_ADDR hwcap =3D linux_get_hwcap (target); CORE_ADDR hwcap2 =3D linux_get_hwcap2 (target); =20 bool pauth_p =3D hwcap & AARCH64_HWCAP_PACA; bool mte_p =3D hwcap2 & HWCAP2_MTE; return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, ab= fd), - pauth_p, mte_p, false); + pauth_p, mte_p, tls !=3D nullptr); } =20 /* Implementation of `gdbarch_stap_is_single_operand', as defined in diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h index 8ae33efc605..9a7e4339dba 100644 --- a/gdb/aarch64-linux-tdep.h +++ b/gdb/aarch64-linux-tdep.h @@ -39,6 +39,9 @@ /* The MTE regset consists of a 64-bit register. */ #define AARCH64_LINUX_SIZEOF_MTE_REGSET (8) =20 +/* The TLS regset consists of a single register. */ +#define AARCH64_LINUX_SIZEOF_TLSREGSET (X_REGISTER_SIZE) + extern const struct regset aarch64_linux_gregset; extern const struct regset aarch64_linux_fpregset;