aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-08-13 11:39:58 -0600
committerTom Tromey <tromey@adacore.com>2019-08-19 10:32:03 -0600
commitf21c2bd7b7ef2a9c47e5713cabaa784bcf5c2bee (patch)
treeb59e02ba87703ec277f2f63dbc1e6b617d3b6b92 /gdb/printcmd.c
parentAdd Rust support to source highlighting (diff)
downloadbinutils-gdb-f21c2bd7b7ef2a9c47e5713cabaa784bcf5c2bee.tar.gz
binutils-gdb-f21c2bd7b7ef2a9c47e5713cabaa784bcf5c2bee.tar.bz2
binutils-gdb-f21c2bd7b7ef2a9c47e5713cabaa784bcf5c2bee.zip
Fix Fortran regression with variables in nested functions
Sergio pointed out that commit commit aa3b6533 ("Allow nested function displays") regressed a few gdb.fortran tests. I was able to reproduce these failures with gcc head. The bug is that some spots calling contained_in will in fact do the wrong thing if nested functions are considered as contained. In the particular case of the Fortran regression, it was the call in block_innermost_frame, being called from get_hosting_frame -- in this case, the caller is specifically trying to avoid the nested case. This patch fixes the problem by adding an "allow_nested" parameter to contained_in, essentially reverting the change for most callers. gdb/ChangeLog 2019-08-19 Tom Tromey <tromey@adacore.com> * printcmd.c (do_one_display, info_display_command): Update. * block.h (contained_in): Return bool. Add allow_nested parameter. * block.c (contained_in): Return bool. Add allow_nested parameter.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 7529842e73b..9b29b53ca74 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1936,7 +1936,8 @@ do_one_display (struct display *d)
if (d->block)
{
if (d->pspace == current_program_space)
- within_current_scope = contained_in (get_selected_block (0), d->block);
+ within_current_scope = contained_in (get_selected_block (0), d->block,
+ true);
else
within_current_scope = 0;
}
@@ -2098,7 +2099,7 @@ Num Enb Expression\n"));
else if (d->format.format)
printf_filtered ("/%c ", d->format.format);
puts_filtered (d->exp_string);
- if (d->block && !contained_in (get_selected_block (0), d->block))
+ if (d->block && !contained_in (get_selected_block (0), d->block, true))
printf_filtered (_(" (cannot be evaluated in the current context)"));
printf_filtered ("\n");
}