From patchwork Tue Feb 27 03:12:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 207018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2464718dyb; Mon, 26 Feb 2024 19:14:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxx652oPj56Yd9682eu5SlUevnRwWAFOyYvs1qT8fA9rooSOUme9ljHs6cFbOto3K64FM0kFhpJxZR2bPj86Vn1nJeBA== X-Google-Smtp-Source: AGHT+IErOCLODzCB/x1B8k/jzYxW7U9+jvK/krxRUieW+TkumWxiNYzGOkdxriIAv3E0FQPQF2M4 X-Received: by 2002:a81:f90c:0:b0:608:e133:7ece with SMTP id x12-20020a81f90c000000b00608e1337ecemr933135ywm.36.1709003642626; Mon, 26 Feb 2024 19:14:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709003642; cv=pass; d=google.com; s=arc-20160816; b=ye5XSLBNyVnDTudJz97ydUDHleUcHD0deDUA5cCRRTbipJYHlKwiZBv9kaB5ZdRYAn +ZVmFmihfpWQiSYiOpZd077DUu2RTfAqpgY8fEU/9UrCC8T1CZ/+3pZccI5QROCXlkjF sAX4gh/SzLbwTC5QAdSRC4yBu7mrGShyJBTgZ+g7sW/VMmnbYznvUI5SRSD1NjN4/HPQ sU8tKXcLLxHYtgFzLcsoZK7Ewi6AIvB4teHk5JjP63L6v0DAnDtWsg+CAQa9nPSdBjOz V92SpZJ/oruSKBeOyHsWk9nqxTwd44UGwbteO0KcESidEXgwKVfheudKOWAcbpi1HZn6 L90g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=1pZPO76XsxeLjc2hFeINTGq7V5YPV821DPPhqQmaUOk=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=HQ8eAw2vVEv63DmOOVofuB1P8YVFN43rHNyIqJ1zC9TvuTfZOFW8Yj1xWC8YnXC0uA Z2cgupabyX9F08qLTdaYENoop9pdfikyC4eMdtMSxhaEornpOsEQgZTYCyVm8Zvm5xnr J8uVcC+1kJyCZenxTxPvAkXd03J8FQhlkVD6wqKUwMIiybSwWb5UBgMg1cPCiiFgyUiT pfPKykz+zXTBk42gllWzEHF+9p9Zp78+HgeyEZE2N+KVuPgmxuJZjCOqCLgzzoNYunGa Dg0rCbGU+Y13uhStNyIKUQtzzYNzDcgqszjRBcG2wikNYnes2CaR4ITiSmpgqkhzEwWa DPvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@tromey.com header.s=default header.b=oKaTtF11; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c22-20020a05622a025600b0042e8062aecfsi4627568qtx.283.2024.02.26.19.14.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 19:14:02 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@tromey.com header.s=default header.b=oKaTtF11; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58BE53858C5E for ; Tue, 27 Feb 2024 03:14:02 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 2D5213858C54 for ; Tue, 27 Feb 2024 03:13:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D5213858C54 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2D5213858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709003586; cv=none; b=MyLfj8THUtVDgVWSP2LWnS3neaFCKqXX07NaG2Fo1BPPqH99sbdz+N8LbHMGJe0XcsKXU2a4jqcRFo8XS56fsi1RnDwyLs382zvNH2UCxBB0iHzZxR9AXYfu+ajqBxEdUSL1qrPUDWb6NWM+MKZL4MeIuiD0k0GBxPiv3Q5rFnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709003586; c=relaxed/simple; bh=zzW5pD3sLo/cHm7/gSSJ628UshXp4FvlMVaY+0qZM2g=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=uFJZysdJ4xHRV+UK2sUYjmylLUucik1XtwmQRQuVZGrHjC+qFPcJHuXsfqM/6W/E5sbPdFDVIujBb7scbpuXnnEmYS5t03vCGNEF+WhqwSJHWIPU6t0uFtpYYbOJ9Db1XXIdMqWLOePTb8FP26eEGbSCpsNGyfX9G00zTGFsPBU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5004a.ext.cloudfilter.net ([10.0.29.221]) by cmsmtp with ESMTPS id ek2yrvo6zDI6fenturMGNw; Tue, 27 Feb 2024 03:13:02 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id enttrQIhDk2tLentur22IC; Tue, 27 Feb 2024 03:13:02 +0000 X-Authority-Analysis: v=2.4 cv=Xvr8O0F9 c=1 sm=1 tr=0 ts=65dd533e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=zstS-IiYAAAA:8 a=5S_eGvRSsEjQ3BIV9RUA:9 a=QEXdDO2ut3YA:10 a=JBl1FMDXjovBvWafNo1k:22 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=1pZPO76XsxeLjc2hFeINTGq7V5YPV821DPPhqQmaUOk=; b=oKaTtF11Skb7uoD47j1wdFRRBk b8FmilOrcJfIuMPjYy9+VfxNedf54hmHO9Q5MBd/k/nHAhGN9a7wWbioiw/0091ULKw7awnUCJ41G vUUHBG6RaN7O6jYwGs+QPhhAU; Received: from 71-211-170-195.hlrn.qwest.net ([71.211.170.195]:51654 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rentt-004JgU-1S for gcc-patches@gcc.gnu.org; Mon, 26 Feb 2024 20:13:01 -0700 From: Tom Tromey Date: Mon, 26 Feb 2024 20:12:55 -0700 Subject: [PATCH 2/3] Fix version negotiation in libcc1 plugins MIME-Version: 1.0 Message-Id: <20240226-gdb-compile-align-v1-2-0f95d6435299@tromey.com> References: <20240226-gdb-compile-align-v1-0-0f95d6435299@tromey.com> In-Reply-To: <20240226-gdb-compile-align-v1-0-0f95d6435299@tromey.com> To: gcc-patches@gcc.gnu.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.170.195 X-Source-L: No X-Exim-ID: 1rentt-004JgU-1S X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-170-195.hlrn.qwest.net ([192.168.0.21]) [71.211.170.195]:51654 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEBXPIJYuAAGxhCJZtYVSeefy2IWsadCUzIiwJMeT4xsxAy03X5akIFh+a822UFXulbY5DXKMenuPkrRM27iAQaa9YvcS7ZJRkSfi09s7VsBcve1ErDT SDitqA/q8qKpoFlIVi3G081T+9/Y011qbTOXsBQSbBrFCqkWsxSmDAaV0RURwP0pnOShCFu2H9MeFv0LO3ZtClH2COX5SWgFKg0= X-Spam-Status: No, score=-3022.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792020203390986662 X-GMAIL-MSGID: 1792020203390986662 This fixes version negotiation in the libcc1 plugins. It's done in a simple way: the version number from the context object is now passed to base_gdb_plugin. The idea behind this is that when the client (gdb) requests version N, the plugin should respond with the newest version that it knows of that is backward compatible to N. That is, the connection can be upgraded. Note that the protocol does not change much, and no backward incompatibilities have ever been needed. The C plugin is also changed to advertise GCC_C_FE_VERSION_1. The version negotiation approach should of course be documented, but I did that in a subsequent patch, in order to only have one patch touching the 'include' directory and thus needing a merge to binutils-gdb. 2024-02-26 Tom Tromey * libcp1.cc (libcp1::libcp1): Use FE version number from context. * libcc1.cc (libcc1::libcc1): Use FE version number from context. (c_vtable): Use GCC_C_FE_VERSION_1. --- libcc1/ChangeLog | 6 ++++++ libcc1/libcc1.cc | 4 ++-- libcc1/libcp1.cc | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index b0b31ee6586..b4072574ba8 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,9 @@ +2024-02-26 Tom Tromey + + * libcp1.cc (libcp1::libcp1): Use FE version number from context. + * libcc1.cc (libcc1::libcc1): Use FE version number from context. + (c_vtable): Use GCC_C_FE_VERSION_1. + 2024-02-26 Tom Tromey * libcc1plugin.cc (safe_lookup_builtin_type): Handle ERROR_MARK. diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc index 8d4ddc5ddfe..992181e8fdc 100644 --- a/libcc1/libcc1.cc +++ b/libcc1/libcc1.cc @@ -54,7 +54,7 @@ struct libcc1 : public cc1_plugin::base_gdb_plugin libcc1::libcc1 (const gcc_c_fe_vtable *cv) : cc1_plugin::base_gdb_plugin ("libcc1plugin", C_COMPILER_NAME, - GCC_C_FE_VERSION_1) + cv->c_version) { c_ops = cv; } @@ -108,7 +108,7 @@ set_callbacks (struct gcc_c_context *s, static const struct gcc_c_fe_vtable c_vtable = { - GCC_C_FE_VERSION_0, + GCC_C_FE_VERSION_1, set_callbacks, #define GCC_METHOD0(R, N) \ diff --git a/libcc1/libcp1.cc b/libcc1/libcp1.cc index ec3eec2c606..cc2915d30af 100644 --- a/libcc1/libcp1.cc +++ b/libcc1/libcp1.cc @@ -55,7 +55,7 @@ struct libcp1 : public cc1_plugin::base_gdb_plugin libcp1::libcp1 (const gcc_cp_fe_vtable *cv) : cc1_plugin::base_gdb_plugin ("libcp1plugin", CP_COMPILER_NAME, - GCC_CP_FE_VERSION_0) + cv->cp_version) { cp_ops = cv; }