From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2039.outbound.protection.outlook.com [40.92.91.39]) by sourceware.org (Postfix) with ESMTPS id B9E8A39BD407 for ; Sat, 5 Jun 2021 12:27:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B9E8A39BD407 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LM6laN/DKQbf6VaSWuFvk6VqPCKA/h9xgRj1fbWdpL+7sX708/5z95lA9FVFoK1o9kmbFjRUPQxjJN3YxQCcva27XnxY3lBTdP6ho1YqzD+f/itVxLEE42VRTiqwY+6t8eyvo6DwwR7SOdzylu+W38zXW8y/VHfzQupnT6utirLYq909axfnzaWgjQ3hSvYUahzF+Cq+6uTQjWSSfJgz9AwDVgBc+y/CjCVxmggrSd8deZmPEM/6P0WaKeDOfVy+GkbQd9x4nhvi8VT5NM9CI/dBNzVXMLTYiHiIH5JCIRfCdI5K0LQLueSi/cOIQYITcwxvIKrLgNi+8iBWV+cqng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WTEZFhryfSzZ81YA2wp9iUIrC1kA23AykLmDDB7yIuo=; b=XTxA4d3wA9iMJBD5dw38tDsdXXDiVvjNPH0wQ5NcXdgwaM59XezBlSX8WrQKLQ3a/YCxKwrqEi7cvBW976YquXyh5h179a+P+Dhvp2ClW6No1b+zGAFu9tNrA3OGOwQfBljUAZxYu4luDPGGhMDQn0Es69wOb6n/W2VhvBsalcvA0Mcp9uaj0yGnmvHY6y6gjpB1SCa9tz+Ddr8YoMO/QZNbQ5R8bfRokT86wrOG4z9+kmSTHMCptbJfm/+8RtYh1mFNCL5oCBSd5d1Y3/OvqeiUQsh6MUPv0RYcHvDd8QxZUHnGhufzb751maH4jYU7vPn13mHV7yZd1K0HhJ/lMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from VI1EUR05FT044.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::51) by VI1EUR05HT231.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::410) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.18; Sat, 5 Jun 2021 12:27:17 +0000 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:fc12::43) by VI1EUR05FT044.mail.protection.outlook.com (2a01:111:e400:fc12::263) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.18 via Frontend Transport; Sat, 5 Jun 2021 12:27:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E093FB1BA50FE6E3893A9A74DDC9AD6896819B22F01276EB3987511CF5201447; UpperCasedChecksum:8125CB71DBFF1EF8A24E677ED17779E1341EE7ACB5E26FF75A90133A0881D502; SizeAsReceived:8240; Count:48 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::ad12:6a2c:b949:f65d]) by AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::ad12:6a2c:b949:f65d%5]) with mapi id 15.20.4195.025; Sat, 5 Jun 2021 12:27:17 +0000 Subject: Re: [PATCH] Fix gdb crash due to SIGPIPE when the compile command fails To: Andrew Burgess Cc: Tom Tromey , "gdb-patches@sourceware.org" References: <87tumgp1ob.fsf@tromey.com> <87zgw5oijf.fsf@tromey.com> <20210605120453.GR2672@embecosm.com> From: Bernd Edlinger Message-ID: Date: Sat, 5 Jun 2021 14:27:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: <20210605120453.GR2672@embecosm.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TMN: [Pl8Lk2YXOU6QrIfc5RWDdFtZUhIbvNcz] X-ClientProxiedBy: FR0P281CA0069.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::22) To AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:364::23) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (84.57.61.94) by FR0P281CA0069.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.10 via Frontend Transport; Sat, 5 Jun 2021 12:27:16 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f52a9846-d7f9-47fd-3a5d-08d9281d41b4 X-MS-TrafficTypeDiagnostic: VI1EUR05HT231: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HkspN9f0ygr+XCqbq/pAP6eUsmnpcF2afYMcvB3Wpo+xc7xGkQf2n4mvbpKuowDYA/YTudVOtee0McgaBP/nydSpjtKrgoiDafU2q2bgaM6NA247GokNEhWwFSA0ioiyLkq8vkt6EuJCHYj7h7+CBwZxDFWPnhxJpcSRCwLi0HcFU8oU9sfKUr9EucyjeqXWMbUVwpEIahxy0ZfPcLXKUTMnNQ+S3BjfYUPaHGwm+HtCfaqOPOfw1nYqn5EfZkHSp8t0u86G4JU+wXrCTm/qW7HrtGJ3VVOoO4Sbb5c1oSicj6ncaIcSdEWb1rUv2XEL+AMbSM1ylcY/DKwADIazA2QM52JHRsLyF6BzeGfCnLkX2u0e2f4z2apgTD2HnxV/nLpCLpWYQ8+QSY2lPJridQ== X-MS-Exchange-AntiSpam-MessageData: 5IwOzW1aHQP6ETRGRD8NXS3JpiLp01wK8vtLSGpymglbSs78YHz8QKeabsuaGGcQ678sqhqEjdwbe2VUwHiRBgb5j+0GJlcc8Vm/rhNx6VpkhWwd2zvuGMPOczLvJRalnArh+hcyxBD1uFt71m2E+Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f52a9846-d7f9-47fd-3a5d-08d9281d41b4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2021 12:27:17.3936 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT044.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1EUR05HT231 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FROM, GIT_PATCH_0, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 12:27:29 -0000 On 6/5/21 2:04 PM, Andrew Burgess wrote: > * Bernd Edlinger [2021-06-05 13:44:03 +0200]: > >> On 6/4/21 3:39 PM, Tom Tromey wrote: >>>>>>>> "Bernd" == Bernd Edlinger writes: >>> Bernd> I believe it is right to avoid the SIGPIPE before calling the plugin, >>> Bernd> instead of doing that in gcc-trunk, since we don't know which version >>> Bernd> we will be calling, and all versions I tried have failed like this. >>> >>> That seems fine, but I think it would be better to install the handler >>> just when working with the plugin, and then uninstall it afterward, sort >>> of like what class scoped_ignore_sigttou does. >>> >> Okay, done, that works for me. >> >> Is this OK? >> >> >> Thanks >> Bernd. >> >> From 3bb3966601a89c18ea2700c3eae4aa4f4e195269 Mon Sep 17 00:00:00 2001 >> From: Bernd Edlinger >> Date: Wed, 2 Jun 2021 19:21:15 +0200 >> Subject: [PATCH] Fix gdb crash due to SIGPIPE when the compile command fails >> >> Due to the SIGPIPE the gdb process is killed here, which is >> not helpful. >> >> 2021-06-02 Bernd Edlinger >> >> * compile/compile.c (compile_to_object): Ignore SIGPIPE before calling >> the plugin. >> --- >> gdb/compile/compile.c | 31 +++++++++++++++++++++++++++++++ >> 1 file changed, 31 insertions(+) >> >> diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c >> index 8481d14..3431d4c 100644 >> --- a/gdb/compile/compile.c >> +++ b/gdb/compile/compile.c >> @@ -633,6 +633,33 @@ struct compile_options >> fputs_filtered (message, gdb_stderr); >> } >> >> +/* RAII class used to ignore SIGPIPE in a scope. */ >> + >> +class scoped_ignore_sigpipe >> +{ >> +public: >> + scoped_ignore_sigpipe () >> + { >> +#ifdef SIGPIPE >> + m_osigpipe = signal (SIGPIPE, SIG_IGN); >> +#endif >> + } >> + >> + ~scoped_ignore_sigpipe () >> + { >> +#ifdef SIGTTOU > SIGPIPE? > Ah, yes of course! Consider this fixed. Thanks, Bernd.