From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21318 invoked by alias); 24 Sep 2014 18:53:44 -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 21211 invoked by uid 89); 24 Sep 2014 18:53:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 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; Wed, 24 Sep 2014 18:53:41 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8OIra4Y023510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 24 Sep 2014 14:53:36 -0400 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8OIra45015923 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 24 Sep 2014 14:53:36 -0400 From: Sergio Durigan Junior To: Simon Marchi Cc: Subject: Re: [PATCH] Don't prune program spaces when doing "maintenance info program-spaces" References: <1411582288-20967-1-git-send-email-simon.marchi@ericsson.com> X-URL: http://www.redhat.com Date: Wed, 24 Sep 2014 18:53:00 -0000 In-Reply-To: <1411582288-20967-1-git-send-email-simon.marchi@ericsson.com> (Simon Marchi's message of "Wed, 24 Sep 2014 14:11:28 -0400") Message-ID: <87h9zwn93k.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00714.txt.bz2 On Wednesday, September 24 2014, Simon Marchi wrote: > While debugging a program spaces issue, I found that "maintenance info > program-spaces" pruned the program spaces prior to printing them. I > don't think a command to inspect the state of the program (especially > a maintenance one) should modify the state. All it can do is potentially > hide bugs. Hi Simon, Thanks for the patch. I agree with your rationale, and just have one comment. > --- > gdb/progspace.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/gdb/progspace.c b/gdb/progspace.c > index a74b6ab..aef2d4e 100644 > --- a/gdb/progspace.c > +++ b/gdb/progspace.c > @@ -272,18 +272,19 @@ prune_program_spaces (void) > > /* Prints the list of program spaces and their details on UIOUT. If > REQUESTED is not -1, it's the ID of the pspace that should be > - printed. Otherwise, all spaces are printed. */ > + printed. Otherwise, all spaces are printed. If PRUNE is true, > + prune the unused program spaces prior to printing them, so they > + won't be displayed. */ > > static void > -print_program_space (struct ui_out *uiout, int requested) > +print_program_space (struct ui_out *uiout, int requested, int prune) > { > struct program_space *pspace; > int count = 0; > struct cleanup *old_chain; > > - /* Might as well prune away unneeded ones, so the user doesn't even > - seem them. */ > - prune_program_spaces (); > + if (prune) > + prune_program_spaces (); > > /* Compute number of pspaces we will print. */ > ALL_PSPACES (pspace) > @@ -385,7 +386,7 @@ maintenance_info_program_spaces_command (char *args, int from_tty) > error (_("program space ID %d not known."), requested); > } > > - print_program_space (current_uiout, requested); > + print_program_space (current_uiout, requested, 0 /* prune */); Just like we had a comment explaining why we were pruning progspaces, I think a small comment here explaining why we are *not* pruning them would be neat. Otherwise, looks good to me (this is not an approval). Thanks, -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/