From patchwork Wed Jun 12 09:59:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 33089 Received: (qmail 59883 invoked by alias); 12 Jun 2019 09:59: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 59874 invoked by uid 89); 12 Jun 2019 09:59:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=INFO X-HELO: EUR03-AM5-obe.outbound.protection.outlook.com Received: from mail-eopbgr30062.outbound.protection.outlook.com (HELO EUR03-AM5-obe.outbound.protection.outlook.com) (40.107.3.62) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jun 2019 09:59:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6DrpEMVUaq+WniQjKuHOT7C6rCAs00oU3Me/fBBGpkw=; b=G2DQ21uugrtQde/c3Ho695ZpbCRcqBEugK719K14kle7rr9cGHBg+jEcumQMV4WpqfnXtz9RIfU4t/pCs636s6PcP3p6RaDJ2ljWv7dv7VQKs/VCWzZ2oe1X/XW91QV7iyGkKXEgMit0s+1+xdv9KPXCXnyicANTFEKID1jUhr8= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2247.eurprd08.prod.outlook.com (10.172.226.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.14; Wed, 12 Jun 2019 09:59:15 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c26:bb4b:6c93:9d40]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c26:bb4b:6c93:9d40%2]) with mapi id 15.20.1965.017; Wed, 12 Jun 2019 09:59:15 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH] Arm: Allow version strings in the triplet regexp Date: Wed, 12 Jun 2019 09:59:15 +0000 Message-ID: <20190612095912.86640-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-oob-tlc-oobclassifiers: OLM:10000; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Alan.Hayward@arm.com X-IsSubscribed: yes On Arm, the OS may use the full version string for the arch name when installing the compiler, for example armv7hl-redhat-linux-gnueabi-gcc. Implement gdbarch_gnu_triplet_regexp for Arm to allow this to be detected. Ensure that other Arm targets (eg iwmmxt) are not affected. This fixes the compile/ set of tests on those systems. gdb/ChangeLog: 2019-06-12 Alan Hayward * arm-tdep.c (arm_gnu_triplet_regexp): New function. (arm_gdbarch_init): Add arm_gnu_triplet_regexp. --- gdb/arm-tdep.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.20.1 (Apple Git-117) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 742bfa5706..09a8b51849 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -8838,7 +8838,17 @@ arm_code_of_frame_writable (struct gdbarch *gdbarch, struct frame_info *frame) return 1; } - +/* Implement gdbarch_gnu_triplet_regexp. If the arch name is arm then allow it + to be postfixed by a version (eg armv7hl). */ + +static const char * +arm_gnu_triplet_regexp (struct gdbarch *gdbarch) +{ + if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm") == 0) + return "arm(v[^- ]*)?"; + return gdbarch_bfd_arch_info (gdbarch)->arch_name; +} + /* Initialize the current architecture based on INFO. If possible, re-use an architecture from ARCHES, which is a list of architectures already created during this debugging session. @@ -9440,6 +9450,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_disassembler_options (gdbarch, &arm_disassembler_options); set_gdbarch_valid_disassembler_options (gdbarch, disassembler_options_arm ()); + set_gdbarch_gnu_triplet_regexp (gdbarch, arm_gnu_triplet_regexp); + return gdbarch; }