From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2607:f138:0:13::2]) by sourceware.org (Postfix) with ESMTPS id 789843888C6D; Wed, 23 Mar 2022 21:01:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 789843888C6D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id CDD6D1A84E61; Wed, 23 Mar 2022 17:00:59 -0400 (EDT) From: John Baldwin To: binutils@sourceware.org, gdb-patches@sourceware.org Subject: [PATCH 09/12] Read the tpidr register from NT_ARM_TLS core dump notes on FreeBSD/Aarch64. Date: Wed, 23 Mar 2022 14:00:48 -0700 Message-Id: <20220323210048.25525-10-jhb@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323210048.25525-1-jhb@FreeBSD.org> References: <20220323210048.25525-1-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Wed, 23 Mar 2022 17:01:00 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2022 21:01:01 -0000 --- 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..3fb1010d43e 100644 --- a/gdb/aarch64-fbsd-tdep.c +++ b/gdb/aarch64-fbsd-tdep.c @@ -142,10 +142,42 @@ aarch64_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, void *cb_data, const struct regcache *regcache) { + aarch64_gdbarch_tdep *tdep = (aarch64_gdbarch_tdep *) gdbarch_tdep (gdbarch); + 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 ()) + { + /* Create this on the fly in order to handle the variable location. */ + const struct regcache_map_entry tls_regmap[] = + { + { 1, AARCH64_TPIDR_REGNUM (tdep->tls_reg_base), 8}, + { 0 } + }; + + const struct regset aarch64_fbsd_tls_regset = + { + 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 = bfd_get_section_by_name (abfd, ".reg-aarch-tls"); + + return aarch64_read_description (0, false, false, tls != nullptr); } /* 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) set_gdbarch_iterate_over_regset_sections (gdbarch, aarch64_fbsd_iterate_over_regset_sections); + set_gdbarch_core_read_description (gdbarch, + aarch64_fbsd_core_read_description); } 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) +/* 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; -- 2.34.1