Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Paul Hilfinger <Hilfinger@adacore.com>
Cc: Eli Zaretskii <eliz@gnu.org>, gdb-patches@sourceware.org
Subject: Re: [RFA] Have block_innermost_frame start from selected frame
Date: Tue, 10 Jan 2012 05:21:00 -0000	[thread overview]
Message-ID: <20120110043213.GC31383@adacore.com> (raw)
In-Reply-To: <20120109071645.93E9F92BF6@kwai.gnat.com>

Hi Paul,

> 2011-12-27  Paul Hilfinger  <hilfingr@adacore.com>
> 
>   * gdb/blockframe.c (block_innermost_frame): Start search from selected frame,
>     if present, or otherwise the current frame.
> 
>   * gdb/c-exp.y, gdb/m2-exp.y, gdb/objc-exp.y: Update innermost_block
> 
>   * gdb/doc/gdb.texinfo (Variables): Document use of :: for non-static
>     variables.

When you create an entry in gdb's ChangeLog file, can you remember
to remove the "gdb/" prefix? Also, the doc/ subdirectory has its own
ChangeLog file as well, so remember to remove the "gdb/doc/" prefix
in the filename.

> -/* Return the innermost stack frame executing inside of BLOCK, or NULL
> -   if there is no such frame.  If BLOCK is NULL, just return NULL.  */
> +/* Return the innermost stack frame that is executing inside of BLOCK and is
> + * at least as old as the selected frame. Return NULL if there is no
> + * such frame.  If BLOCK is NULL, just return NULL.  */

Minor issue with formatting: Can you remove the '*' at the start of
the second and third line?

> -  frame = get_current_frame ();
> +  frame = get_selected_frame_if_set ();
> +  if (frame == NULL)
> +    frame = get_current_frame ();

I really flip-flopped on this, between using get_selected_frame_if_set
or just get_selected_frame. In the end, to me, the real difference
between the two is the fact that the second could potentially *change*
the global state (selected frame, language). These could be considered
side-effects while I have a feeling that block_innermost_frame is
a function that should really be pure. So I agree with you that using
get_selected_frame_if_set was the right choice.

> +			  if (symbol_read_needs_frame (sym))
> +			    {
> +			      if (innermost_block == 0
> +				  || contained_in (block_found, 
> +						   innermost_block))
> +				innermost_block = block_found;
> +			    }

I know you copied this from elsewhere in the file, and that elsewhere
also has that extraneous trailing space (`|| contained_in (block_found, '),
but could you remove it from this new hunk?

> +@smallexample
> +void
> +foo (int a)
> +@{
> +  if (a < 10)
> +      bar (a);
> +  else
> +      process (a);    /* Stop here */
> +@}

Nit-picking: The formatting looks a little off for the if and else
blocks.  It would be nicer, I think, if we remained consistent the GDB
style...

Eli?

> +@smallexample
> +(@value{GDBP}) p a
> +(@value{GDBP}) p bar::a
> +(@value{GDBP}) up 2
> +(@value{GDBP}) p a
> +(@value{GDBP}) p bar::a
> +@end smallexample
> +
> +@noindent
> +will print the values @samp{10}, @samp{5}, @samp{5}, and @samp{0} in that
> +order.

My 2 cents: We could also embed the GDB transcript, rather than
having the input on one end, and the output on the other hand.
Not a request to change, just some thoughts...

-- 
Joel


  parent reply	other threads:[~2012-01-10  4:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-30 21:54 Paul Hilfinger
2011-12-31  8:58 ` Eli Zaretskii
2011-12-31 21:40   ` Paul Hilfinger
2012-01-09  7:17   ` Paul Hilfinger
2012-01-09 17:14     ` Eli Zaretskii
2012-01-09 19:59       ` Paul Hilfinger
2012-01-10  5:21     ` Joel Brobecker [this message]
2012-01-10 10:28       ` Eli Zaretskii
2012-01-10 10:40       ` Joel Brobecker
2012-01-11 10:59         ` [PATCH 1/3] Have block_innermost_frame start from selected frame and document Hilfinger
2012-01-11 15:54           ` [PATCH 2/3] Add testcase for locals identified with FUNCTION::VAR syntax Hilfinger
2012-01-11 10:59             ` [PATCH 3/3] Add test for use of "<block>::<variable>" syntax for locals in watch Hilfinger
  -- strict thread matches above, loose matches on Subject: below --
2011-12-27 19:59 [RFA] Have block_innermost_frame start from selected frame Paul Hilfinger
2011-12-28 13:10 ` Jan Kratochvil
2011-12-28 15:41   ` Joel Brobecker
2011-12-28 16:00     ` Jan Kratochvil
2011-12-28 17:23       ` Joel Brobecker
2011-12-29 20:30   ` Paul Hilfinger
2011-12-29 23:13     ` Jan Kratochvil
2011-12-28 15:16 ` Jan Kratochvil

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=20120110043213.GC31383@adacore.com \
    --to=brobecker@adacore.com \
    --cc=Hilfinger@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /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