public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Paul Hilfinger <Hilfinger@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] Have block_innermost_frame start from selected frame
Date: Tue, 27 Dec 2011 19:59:00 -0000	[thread overview]
Message-ID: <20111227195809.672D892BF6@kwai.gnat.com> (raw)


The GDB documentation suggests that the notation FOO::x is intended for static
variables, but in fact it also "works" for local variables as well.  For
various reasons, we tend to do this quite a bit in Ada, but the issue
raised here comes up in C as well (the message following this one contains a
proposed test case in C).  The change proposed here causes no regressions, but
the obvious question is why things currently work as they do (FOO::x ignores
the selected frame).  Is this because (as we hope) nobody else uses FOO:: for
referencing local variables?

Previously, GDB would search for the frame containing variables in a
particular lexical block starting from the current (top) frame,
ignoring any currently selected frame.  It is not clear why this is
desirable for variables that require a frame; why would a user
deliberately select one frame and then expect to see the value of a
variable in a more recent frame?  This change causes
block_innermost_frame to start looking from the selected frame, if
there is one.

This change is perhaps unnecessarily conservative.  It uses
get_selected_frame_if_set rather than get_selected_frame in order to
avoid the side effect of calling select_frame, which would probably be
harmless.

Paul N. Hilfinger


2011-12-27  Paul Hilfinger  <hilfingr@adacore.com>

* gdb/blockframe.c (block_innermost_frame): Start search from selected from,
    if present, or otherwise the current frame.
---
 gdb/ChangeLog    |    5 +++++
 gdb/blockframe.c |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 87031a6..39bc63a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-27  Paul Hilfinger  <hilfingr@adacore.com>
+
+        * blockframe.c (block_innermost_frame): Start search from 
+        selected from,if present, or otherwise the current frame.
+
 2011-12-27  Joel Brobecker  <brobecker@adacore.com>
 
 	* ada-lang.c (should_use_wild_match): New function.
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index ef53a3d..92271ff 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -370,7 +370,9 @@ block_innermost_frame (const struct block *block)
   start = BLOCK_START (block);
   end = BLOCK_END (block);
 
-  frame = get_current_frame ();
+  frame = get_selected_frame_if_set ();
+  if (frame == NULL)
+    frame = get_current_frame ();
   while (frame != NULL)
     {
       struct block *frame_block = get_frame_block (frame, NULL);
-- 
1.7.0.4



             reply	other threads:[~2011-12-27 19:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 19:59 Paul Hilfinger [this message]
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
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
2012-01-10 10:28       ` Eli Zaretskii
2012-01-10 10:40       ` Joel Brobecker

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=20111227195809.672D892BF6@kwai.gnat.com \
    --to=hilfinger@adacore.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).