From patchwork Wed Sep 24 18:11:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 2963 Received: (qmail 16491 invoked by alias); 24 Sep 2014 18:11:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 16478 invoked by uid 89); 24 Sep 2014 18:11:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 24 Sep 2014 18:11:39 +0000 Received: from EUSAAHC006.ericsson.se (Unknown_Domain [147.117.188.90]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 3B.49.25146.8B0B2245; Wed, 24 Sep 2014 13:53:28 +0200 (CEST) Received: from simark-hp.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.90) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 24 Sep 2014 14:11:36 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] Don't prune program spaces when doing "maintenance info program-spaces" Date: Wed, 24 Sep 2014 14:11:28 -0400 Message-ID: <1411582288-20967-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes 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. gdb/Changelog: * progspace.c (print_program_space): Add "prune" parameter. (maintenance_info_program_spaces_command): Update call to print_program_space with new parameter. --- 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 */); } /* Simply returns the count of program spaces. */