From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Don't prune program spaces when doing "maintenance info program-spaces"
Date: Wed, 24 Sep 2014 18:53:00 -0000 [thread overview]
Message-ID: <87h9zwn93k.fsf@redhat.com> (raw)
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")
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/
next prev parent reply other threads:[~2014-09-24 18:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 18:11 Simon Marchi
2014-09-24 18:53 ` Sergio Durigan Junior [this message]
2014-09-24 19:31 ` Simon Marchi
2014-09-24 19:34 ` Sergio Durigan Junior
2014-09-24 22:48 ` Doug Evans
2014-09-25 2:31 ` Sergio Durigan Junior
2014-09-25 14:44 ` Simon Marchi
2014-09-25 19:13 ` Doug Evans
2014-09-26 14:37 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h9zwn93k.fsf@redhat.com \
--to=sergiodj@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).