From patchwork Fri Mar 6 21:31:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 38484 Received: (qmail 50300 invoked by alias); 6 Mar 2020 21:32:20 -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 50290 invoked by uid 89); 6 Mar 2020 21:32:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*f:sk:cover.1, states X-HELO: mga18.intel.com Received: from mga18.intel.com (HELO mga18.intel.com) (134.134.136.126) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 21:32:18 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 13:32:16 -0800 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 06 Mar 2020 13:32:15 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 026LWFuT022425; Fri, 6 Mar 2020 21:32:15 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 026LWEMF020348; Fri, 6 Mar 2020 22:32:14 +0100 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 026LWElw020344; Fri, 6 Mar 2020 22:32:14 +0100 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH 01/31] gdbserver: make linux target op 'cannot_store_register' a predicate function Date: Fri, 6 Mar 2020 22:31:09 +0100 Message-Id: <00e30eefcd8411d24fb37b56d2f1993421ebf8f4.1583529166.git.tankut.baris.aktemur@intel.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes The comment for the linux target op 'cannot_store_register' states the following: /* Returns 0 if we can store the register, 1 if we can not store the register, and 2 if failure to store the register is acceptable. */ There is only one low target, linux-ppc-low, that potentially returns 2. There are two places that call the 'cannot_store_register' target op in linux-low.cc. None of these locations distinguish a '2' from a '1'. Hence, to simplify the definition, make the function a predicate that returns either 0 or 1. This is also consistent with the companion function, 'cannot_fetch_register'. gdbserver/ChangeLog: 2020-03-06 Tankut Baris Aktemur * linux-low.h (struct linux_target_ops): Update the comment for 'cannot_store_register' to return 0 or 1. * linux-ppc-low.cc (ppc_cannot_store_register): Return 1 instead of 2. --- gdbserver/linux-low.h | 7 +++---- gdbserver/linux-ppc-low.cc | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index b69ade98e41..aaf882b8c5b 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -135,11 +135,10 @@ struct linux_target_ops void (*arch_setup) (void); const struct regs_info *(*regs_info) (void); - int (*cannot_fetch_register) (int); - /* Returns 0 if we can store the register, 1 if we can not - store the register, and 2 if failure to store the register - is acceptable. */ + /* Return 0 if we can fetch/store the register, 1 if we cannot + fetch/store the register. */ + int (*cannot_fetch_register) (int); int (*cannot_store_register) (int); /* Hook to fetch a register in some non-standard way. Used for diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc index fd6d0369c48..f3837e47960 100644 --- a/gdbserver/linux-ppc-low.cc +++ b/gdbserver/linux-ppc-low.cc @@ -152,13 +152,13 @@ ppc_cannot_store_register (int regno) /* Some kernels do not allow us to store fpscr. */ if (!(ppc_hwcap & PPC_FEATURE_HAS_SPE) && regno == find_regno (tdesc, "fpscr")) - return 2; + return 1; #endif /* Some kernels do not allow us to store orig_r3 or trap. */ if (regno == find_regno (tdesc, "orig_r3") || regno == find_regno (tdesc, "trap")) - return 2; + return 1; return 0; }