From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23150 invoked by alias); 5 Jul 2013 16:38:16 -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 23139 invoked by uid 89); 5 Jul 2013 16:38:16 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from mms2.broadcom.com (HELO mms2.broadcom.com) (216.31.210.18) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 05 Jul 2013 16:38:13 +0000 Received: from [10.9.208.53] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Fri, 05 Jul 2013 09:32:07 -0700 X-Server-Uuid: 4500596E-606A-40F9-852D-14843D8201B2 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Fri, 5 Jul 2013 09:37:59 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Fri, 5 Jul 2013 09:37:59 -0700 Received: from [10.177.73.66] (unknown [10.177.73.66]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 32947F2D73; Fri, 5 Jul 2013 09:37:59 -0700 (PDT) Message-ID: <51D6F666.4030400@broadcom.com> Date: Fri, 05 Jul 2013 16:38:00 -0000 From: "Andrew Burgess" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Pedro Alves" cc: "gdb-patches@sourceware.org" Subject: Re: [PATCH] optimized out registers in mi References: <51D6C9D8.4000502@broadcom.com> <51D6D22E.2030807@redhat.com> In-Reply-To: <51D6D22E.2030807@redhat.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00204.txt.bz2 On 05/07/2013 3:03 PM, Pedro Alves wrote: > On 07/05/2013 02:27 PM, Andrew Burgess wrote: > >> [1] I applied a patch yesterday that changed value_optimized_out, >> before I applied yesterdays patch the behaviour of -data-list-registers >> was a bit random, if the register value was lazy then you would get >> the "" result, if the value was not lazy then you got >> the error. Of the two behaviours I think returning the >> "" string is by far the most helpful so that's >> the behaviour we now get in all cases. > > Agreed. > > It'd be nice to handle partially optimized out registers > too, though I'm not sure gcc does something like that > currently. And that can be always handled later. This > is already a good step. > >> gdb/ChangeLog > >> - if (format == 'N') >> + /* Displaying optimized out values using anything other than the default >> + format will result in the value 0 being shown. */ > > Please make that s/will/would/. It's confusing as is; it made > me think that printing 0 was what the patch was meaning to do. > > But, this looks hacky to me. Do we print 0 with the CLI as well? > If not, what's handling it that's missing in MI? Isn't this being > handled gracefully somewhere within val_print itself (I'd > think in val_print_scalar_formatted)? The answer to this is a few lines down in the function, it is really the 'r' formatting case that I'm trying to avoid, as this is handled as a special within the output_register function. So, I could probably write: if ((value_optimized_out (val) && format == 'r') || format == 'N') NOTE: The format == 'N' stuff is not mine, and was there before. I didn't write this as I figured the result would be the same whatever format you send into the print code if the value is optimized_out. Now, the next question that comes to me is, why do we handle 'r' as a special case inside output_register.... I can't answer that one, maybe we could / should move it into the generic print code, then you'd be correct and the whole optimized_out check would not be needed. Would your prefer me to try to move the format-'r' code, or is my original patch ok? Cheers, Andrew