From patchwork Tue Dec 5 12:28:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rudo X-Patchwork-Id: 24724 Received: (qmail 34296 invoked by alias); 5 Dec 2017 12:29:07 -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 34257 invoked by uid 89); 5 Dec 2017 12:29:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=among X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Dec 2017 12:29:05 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vB5CSstr091464 for ; Tue, 5 Dec 2017 07:29:04 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ensvsdhqv-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 05 Dec 2017 07:29:03 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Dec 2017 12:29:02 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Dec 2017 12:29:01 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vB5CT1Dn39977086; Tue, 5 Dec 2017 12:29:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF48B4C052; Tue, 5 Dec 2017 12:23:52 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A5D414C04E; Tue, 5 Dec 2017 12:23:52 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 5 Dec 2017 12:23:52 +0000 (GMT) From: Philipp Rudo To: gdb-patches@sourceware.org Cc: Andreas Arnez , Ulrich Weigand Subject: [PATCH v2 01/11] s390: Remove duplicate checks for cached gdbarch at init Date: Tue, 5 Dec 2017 13:28:49 +0100 In-Reply-To: <20171205122859.2919-1-prudo@linux.vnet.ibm.com> References: <20171205122859.2919-1-prudo@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17120512-0040-0000-0000-000004169172 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17120512-0041-0000-0000-000020B98833 Message-Id: <20171205122859.2919-2-prudo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-05_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712050180 X-IsSubscribed: yes When initializing the gdbarch there is a check whether an appropriate gdbarch already exists in the gdbarch_list. If any of the checks fails this would lead to a different target description. However gdbarch_list_lookup_by_info already checks for if (info->target_desc != arches->gdbarch->target_desc) continue; So it never returns a gdbarch where any of the checks can fail. Remove the duplicate check. This also allows to move the lookup at the start of the function. gdb/ChangeLog: * s390-linux-tdep.c (s390_gdbarch_init): Remove douplicate checks when looking for cached gdbarch and move to start of function --- gdb/s390-linux-tdep.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index a0d4cdd740..e3e036a70d 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -7829,6 +7829,11 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) static const char *const stap_register_indirection_suffixes[] = { ")", NULL }; + /* Find a candidate among extant architectures. */ + arches = gdbarch_list_lookup_by_info (arches, &info); + if (arches != NULL) + return arches->gdbarch; + /* Default ABI and register size. */ switch (info.bfd_arch_info->mach) { @@ -8040,27 +8045,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) vector_abi = S390_VECTOR_ABI_128; #endif - /* Find a candidate among extant architectures. */ - for (arches = gdbarch_list_lookup_by_info (arches, &info); - arches != NULL; - arches = gdbarch_list_lookup_by_info (arches->next, &info)) - { - tdep = gdbarch_tdep (arches->gdbarch); - if (!tdep) - continue; - if (tdep->abi != tdep_abi) - continue; - if (tdep->vector_abi != vector_abi) - continue; - if ((tdep->gpr_full_regnum != -1) != have_upper) - continue; - if (tdep->have_gs != have_gs) - continue; - if (tdesc_data != NULL) - tdesc_data_cleanup (tdesc_data); - return arches->gdbarch; - } - /* Otherwise create a new gdbarch for the specified machine type. */ tdep = XCNEW (struct gdbarch_tdep); tdep->abi = tdep_abi;