From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125586 invoked by alias); 28 Feb 2020 20:06:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 125578 invoked by uid 89); 28 Feb 2020 20:06:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2004, quit, H*MI:sk:87wo86i X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Feb 2020 20:06:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582920369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7RsyemQmTsdd7Mf7GcGbdkU+JO8sYQyv/RUidW3IfJY=; b=Jy2J5e56lP/S48GcoTfPybwJnx+gO92PYYkFouEeHyHyVOLk4u9VSLoXBs/fb32cQwRcws VPIpokj0q07oflTIpHGAhurOWcWkITBdiwKkggVVeOJ6rR7eu6UJiV/yr1C6h+ySp6cRtE XD1whTxKvY3Y9axEDO9cSgBGdCP5+C8= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-126-KVmu6noTNyWMT3irpdcs_g-1; Fri, 28 Feb 2020 15:06:07 -0500 Received: by mail-ed1-f72.google.com with SMTP id t20so3068973eds.19 for ; Fri, 28 Feb 2020 12:06:06 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id e12sm608161edc.30.2020.02.28.12.06.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Feb 2020 12:06:04 -0800 (PST) Subject: Re: [PATCH 2/6] Don't reset errno/bfd_error on 'throw_perror_with_name' To: Tom Tromey , Sergio Durigan Junior References: <20190926042155.31481-1-sergiodj@redhat.com> <20200226200542.746617-1-sergiodj@redhat.com> <20200226200542.746617-3-sergiodj@redhat.com> <87wo86ivbu.fsf@tromey.com> Cc: GDB Patches , Eli Zaretskii , Ruslan Kabatsayev From: Pedro Alves Message-ID: Date: Fri, 28 Feb 2020 20:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <87wo86ivbu.fsf@tromey.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-02/txt/msg01073.txt.bz2 On 2/28/20 3:29 PM, Tom Tromey wrote: >>>>>> "Sergio" == Sergio Durigan Junior writes: > > Sergio> Since this hunk may be a bit controversial, I decided to split it into > Sergio> a separate patch. This is going to be needed by the ptrace-error > Sergio> feature; GDB will need to be able to access the value of errno even > Sergio> after a call to our 'perror'-like functions. > > I'm in favor of this. The existing code seems pretty ugly. I'm not sure in favor of relying on errno being preserved from throw site to catch site, with potentially multiple try/catch hops in between. Sergio, can you point out exactly how you're intending to use that? But, I'm in favor of removing this errno/bfd_error clearing too. We used to have more global state clearing around this area, but it's been gradually removed. E.g.: commit 0af679c6e0645a93d5a60ec936b94dc70a2f9e5c Author: Pedro Alves AuthorDate: Tue Apr 12 16:49:30 2016 +0100 Commit: Pedro Alves CommitDate: Tue Apr 12 16:55:35 2016 +0100 Don't call clear_quit_flag in prepare_to_throw_exception I think this is reminiscent of the time when a longjmp would always jump to the top level. Nowaways code that throw exceptions other than a quit, which may even be caught and handled without reaching the top level. Certainly such exceptions shouldn't clear an interrupt request... I suspect this perror_with_name errno/bfd_error clearing was also related to ancient direct longjmp to the top level. > I'd imagine it's unlikely that any caller would rely on this. > If it tested cleanly then that is good enough for me. > > Sergio> Another small hunk is the one that saves/restores errno on gdbserver's > Sergio> 'perror_with_name', but this one is pretty trivial, I think. > > I didn't understand why this one was needed. > Does safe_strerror reset errno? Maybe a comment would be in order. Thanks, Pedro Alves