From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1936) id 6DAFE3858C51; Tue, 3 May 2022 23:10:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DAFE3858C51 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 FreeBSD/Aarch64. X-Act-Checkin: binutils-gdb X-Git-Author: John Baldwin X-Git-Refname: refs/heads/master X-Git-Oldrev: 414d5848bb2766ea7cef162c6ef5862ddb4dfe0f X-Git-Newrev: 0a765c1a8e9c59f4cd0cdaf986291f957fe6ee90 Message-Id: <20220503231054.6DAFE3858C51@sourceware.org> Date: Tue, 3 May 2022 23:10:54 +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:10:54 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0a765c1a8e9c= 59f4cd0cdaf986291f957fe6ee90 commit 0a765c1a8e9c59f4cd0cdaf986291f957fe6ee90 Author: John Baldwin Date: Tue May 3 16:05:10 2022 -0700 Read the tpidr register from NT_ARM_TLS core dump notes on FreeBSD/Aarc= h64. Diff: --- gdb/aarch64-fbsd-tdep.c | 34 ++++++++++++++++++++++++++++++++++ gdb/aarch64-fbsd-tdep.h | 3 +++ 2 files changed, 37 insertions(+) diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c index 32f441892a8..ed1b84387f0 100644 --- a/gdb/aarch64-fbsd-tdep.c +++ b/gdb/aarch64-fbsd-tdep.c @@ -142,10 +142,42 @@ aarch64_fbsd_iterate_over_regset_sections (struct gdb= arch *gdbarch, void *cb_data, const struct regcache *regcache) { + aarch64_gdbarch_tdep *tdep =3D (aarch64_gdbarch_tdep *) gdbarch_tdep (gd= barch); + cb (".reg", AARCH64_FBSD_SIZEOF_GREGSET, AARCH64_FBSD_SIZEOF_GREGSET, &aarch64_fbsd_gregset, NULL, cb_data); cb (".reg2", AARCH64_FBSD_SIZEOF_FPREGSET, AARCH64_FBSD_SIZEOF_FPREGSET, &aarch64_fbsd_fpregset, NULL, cb_data); + + if (tdep->has_tls ()) + { + const struct regcache_map_entry aarch64_fbsd_tls_regmap[] =3D + { + { 1, tdep->tls_regnum, 8 }, + { 0 } + }; + + const struct regset aarch64_fbsd_tls_regset =3D + { + aarch64_fbsd_tls_regmap, + regcache_supply_regset, regcache_collect_regset + }; + + cb (".reg-aarch-tls", AARCH64_FBSD_SIZEOF_TLSREGSET, + AARCH64_FBSD_SIZEOF_TLSREGSET, &aarch64_fbsd_tls_regset, + "TLS register", cb_data); + } +} + +/* Implement the "core_read_description" gdbarch method. */ + +static const struct target_desc * +aarch64_fbsd_core_read_description (struct gdbarch *gdbarch, + struct target_ops *target, bfd *abfd) +{ + asection *tls =3D bfd_get_section_by_name (abfd, ".reg-aarch-tls"); + + return aarch64_read_description (0, false, false, tls !=3D nullptr); } =20 /* Implement the 'init_osabi' method of struct gdb_osabi_handler. */ @@ -168,6 +200,8 @@ aarch64_fbsd_init_abi (struct gdbarch_info info, struct= gdbarch *gdbarch) =20 set_gdbarch_iterate_over_regset_sections (gdbarch, aarch64_fbsd_iterate_over_regset_sections); + set_gdbarch_core_read_description (gdbarch, + aarch64_fbsd_core_read_description); } =20 void _initialize_aarch64_fbsd_tdep (); diff --git a/gdb/aarch64-fbsd-tdep.h b/gdb/aarch64-fbsd-tdep.h index fc8fbee8843..7419ea6be03 100644 --- a/gdb/aarch64-fbsd-tdep.h +++ b/gdb/aarch64-fbsd-tdep.h @@ -32,6 +32,9 @@ alignment. */ #define AARCH64_FBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE) =20 +/* The TLS regset consists of a single register. */ +#define AARCH64_FBSD_SIZEOF_TLSREGSET (X_REGISTER_SIZE) + extern const struct regset aarch64_fbsd_gregset; extern const struct regset aarch64_fbsd_fpregset;