From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17216 invoked by alias); 17 Nov 2015 13:47:06 -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 17200 invoked by uid 89); 17 Nov 2015 13:47:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Nov 2015 13:47:04 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 844561309; Tue, 17 Nov 2015 13:47:03 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAHDl159030406; Tue, 17 Nov 2015 08:47:02 -0500 Message-ID: <564B2FD5.3050005@redhat.com> Date: Tue, 17 Nov 2015 13:47:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Simon Marchi CC: gdb-patches@sourceware.org, Doug Evans Subject: Re: [PATCH] guile/: Add enum casts References: <1446058487-22472-1-git-send-email-palves@redhat.com> <563123AC.2080804@redhat.com> <56312449.2010404@redhat.com> <56312619.9040609@redhat.com> In-Reply-To: <56312619.9040609@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-11/txt/msg00338.txt.bz2 On 10/28/2015 07:46 PM, Pedro Alves wrote: > On 10/28/2015 07:38 PM, Pedro Alves wrote: >> On 10/28/2015 07:36 PM, Pedro Alves wrote: >>> On 10/28/2015 07:29 PM, Simon Marchi wrote: >>> >>>> The status comes from gdbscm_disasm_read_memory returning TARGET_XFER_E_IO: >>>> >>>> return status != NULL ? TARGET_XFER_E_IO : 0; >>>> >>>> Does it make sense that this function returns TARGET_XFER_E_IO, and >>>> not just -1 (or any other non-zero value) on error? It's an >>>> all-or-nothing memory read function, unlike those of the xfer_partial >>>> interface. >>>> >>>> I would have done a change similar to what you have done in >>>> target_read_memory&co: make gdbscm_disasm_read_memory return -1 on >>>> error, and change >>>> memory_error (status, memaddr); >>>> to >>>> memory_error (TARGET_XFER_E_IO, memaddr); >>>> >>>> Would it make sense? >>> >>> I had the same thoughts when I did the target_read_memory&co patch, >>> and went through all the memory_error callers. In the end I left >>> it be because of the IWBN comment: >>> >>> /* TODO: IWBN to distinguish problems reading target memory versus problems >>> with the port (e.g., EOF). >>> We return TARGET_XFER_E_IO here as that's what memory_error looks for. */ >>> return status != NULL ? TARGET_XFER_E_IO : 0; >>> >>> Either way is fine with me. Doug, what would you prefer? >>> >>> Cast? >>> Hardcode TARGET_XFER_E_IO in the memory_error call? >>> Other? >> >> Hmm, reading the comment back, I actually agree with Simon. >> The comment refers to distinguishing memory errors from something >> else not memory errors. In that "something else" case, sounds like >> we wouldn't end up calling memory_error at all. So sounds like Simon's >> suggestion would be the clearer way to go. WDYT? > > Like this? > > From: Pedro Alves > Date: 2015-10-27 17:25:12 +0000 > > guile disassembly hardcode TARGET_XFER_E_IO > > Instead of adding a cast at the memory_error call, as needed for C++, > and have the reader understand the indirection, make it simple and > hardcode the generic memory error at the memory_error call site. > > gdb/ChangeLog: > 2015-10-28 Pedro Alves > > * guile/scm-disasm.c (gdbscm_disasm_read_memory): Return -1 on > error instead of TARGET_XFER_E_IO. > (gdbscm_disasm_memory_error): Always pass TARGET_XFER_E_IO to > memory_error. I pushed this one in now. Thanks, Pedro Alves