From patchwork Mon Dec 5 12:27:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 18191 Received: (qmail 14730 invoked by alias); 5 Dec 2016 12:27:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 14637 invoked by uid 89); 5 Dec 2016 12:27:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=BAYES_00, KAM_LOTSOFHASH, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:linux-a, sk:linuxa, 4746, H*u:sk:Microso X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 05 Dec 2016 12:27:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A010715AB; Mon, 5 Dec 2016 04:27:32 -0800 (PST) Received: from [10.45.32.207] (e105284-mac.manchester.arm.com [10.45.32.207]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C39EB3F445 for ; Mon, 5 Dec 2016 04:27:31 -0800 (PST) User-Agent: Microsoft-MacOutlook/14.7.0.161029 Date: Mon, 05 Dec 2016 12:27:26 +0000 Subject: [PATCH 3/8] AARCH64 SVE: Add gdbserver target methods From: Alan Hayward To: Message-ID: Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit This is part of a series adding AARCH64 SVE support to gdb and gdbserver. This patch changes target methods for gdbserver, specifically: Adds validate_tdesc (by default returns true) Makes arch_setup into target function. These methods will remain unused until a later patch in the series. Tested on x86 and aarch64. Ok to commit? Alan. diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index ae80cddf30694619a115d2ff22e40fd463fc6006..a4cf4746285683e1529142b0073f58b68 eed9cf3 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -2967,6 +2967,13 @@ aarch64_supports_hardware_single_step (void) return 1; } +/* Check the regcache and target descriptor are still valid. */ + +int aarch64_validate_tdesc (struct thread_info *thread) +{ + return 1; +} + struct linux_target_ops the_low_target = { aarch64_arch_setup, @@ -3003,6 +3010,8 @@ struct linux_target_ops the_low_target = aarch64_breakpoint_kind_from_current_state, aarch64_supports_hardware_single_step, aarch64_get_syscall_trapinfo, + NULL, /* get_ipa_tdesc_idx. */ + aarch64_validate_tdesc, }; void diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h index 476816db4821f3ef9a49b1afd407fea2586c7394..b5ac8de5ccee13866d6b74a34d3db8741 2537e66 100644 --- a/gdb/gdbserver/linux-low.h +++ b/gdb/gdbserver/linux-low.h @@ -247,6 +247,9 @@ struct linux_target_ops /* See target.h. */ int (*get_ipa_tdesc_idx) (void); + + /* See target.h. */ + int (*validate_tdesc) (struct thread_info *thread); }; extern struct linux_target_ops the_low_target; diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index e3e372cb9c51ade793a3ffd1915e879fd1a1da42..602f7376c60a9b7b23496e4e0dea437e9 85f7c71 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -6721,6 +6721,15 @@ linux_get_ipa_tdesc_idx (void) } static int +linux_validate_tdesc (struct thread_info *thread) +{ + if (the_low_target.validate_tdesc == NULL) + return 1; + + return (*the_low_target.validate_tdesc) (thread); +} + +static int linux_supports_tracepoints (void) { if (*the_low_target.supports_tracepoints == NULL) @@ -7698,6 +7707,8 @@ static struct target_ops linux_target_ops = { linux_supports_software_single_step, linux_supports_catch_syscall, linux_get_ipa_tdesc_idx, + linux_arch_setup, + linux_validate_tdesc, }; #ifdef HAVE_LINUX_REGSETS diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h index d098a92efef2adcf8ced2d292facda8e2e62db03..de880b41a0ee2de48e56432e87f29353a e369aa9 100644 --- a/gdb/gdbserver/target.h +++ b/gdb/gdbserver/target.h @@ -474,6 +474,13 @@ struct target_ops /* Return tdesc index for IPA. */ int (*get_ipa_tdesc_idx) (void); + + /* Call the target arch_setup function on the current thread. */ + void (*arch_setup) (void); + + /* Check that the target descriptor and regcache are still valid. + Fix them up if they are not. */ + int (*validate_tdesc) (struct thread_info *thread); }; extern struct target_ops *the_target; @@ -561,6 +568,14 @@ int kill_inferior (int); (the_target->get_min_fast_tracepoint_insn_len \ ? (*the_target->get_min_fast_tracepoint_insn_len) () : 0) +#define target_arch_setup(thread) \ + if (the_target->arch_setup) \ + (*the_target->arch_setup) (); + +#define target_validate_tdesc(thread) \ + (the_target->validate_tdesc \ + ? (*the_target->validate_tdesc) (thread) : 1) + #define thread_stopped(thread) \ (*the_target->thread_stopped) (thread)