diff options
author | Paul N. Hilfinger <hilfinger@adacore.com> | 2012-01-11 10:34:21 +0000 |
---|---|---|
committer | Paul N. Hilfinger <hilfinger@adacore.com> | 2012-01-11 10:34:21 +0000 |
commit | 72384ba31a5433c15d67313b339556239bf0c316 (patch) | |
tree | 7b5ce42824c1fc1291e41a6d510c8f546180481d /gdb/m2-exp.y | |
parent | 794e51c094034378e14eec48b628957e71887265 (diff) | |
download | gdb-72384ba31a5433c15d67313b339556239bf0c316.zip gdb-72384ba31a5433c15d67313b339556239bf0c316.tar.gz gdb-72384ba31a5433c15d67313b339556239bf0c316.tar.bz2 |
Have block_innermost_frame start from selected frame and document.
GDB used to 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. It may be
unnecessarily conservative: we use 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.
Expression-parsing routines previously made the unwarranted assumption
that all block-qualified variables (written with the GDB extension
<block>::<variable>) are static. As a result, they failed to update
innermost_block, which confused the watch commands about when
variables in watched expressions went out of scope, and also caused
the wrong variables to be watched. This patch also modifies these
routines to treat all local variables the same whether or not they are
block-qualified.
Finally, we add a paragraph to the "Program Variables" section of the texinfo
documentation concerning the use of "::" for accessing non-static variables.
2012-01-11 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 (variable): Update innermost_block for
'block COLONCOLON NAME' clause.
* gdb/m2-exp.y (variable): Ditto.
* gdb/objc-exp.y (variable): Ditto.
* gdb/doc/gdb.texinfo (Variables): Document use of :: for non-static
variables.
Diffstat (limited to 'gdb/m2-exp.y')
-rw-r--r-- | gdb/m2-exp.y | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 1e3e3cb..ef9ec8e 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -588,6 +588,13 @@ variable: block COLONCOLON NAME if (sym == 0) error (_("No symbol \"%s\" in specified context."), copy_name ($3)); + if (symbol_read_needs_frame (sym)) + { + if (innermost_block == 0 + || contained_in (block_found, + innermost_block)) + innermost_block = block_found; + } write_exp_elt_opcode (OP_VAR_VALUE); /* block_found is set by lookup_symbol. */ |