From f21c2bd7b7ef2a9c47e5713cabaa784bcf5c2bee Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 13 Aug 2019 11:39:58 -0600 Subject: 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 * 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. --- gdb/block.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gdb/block.h') diff --git a/gdb/block.h b/gdb/block.h index 9291deb..4c02e01 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -219,7 +219,15 @@ extern struct symbol *block_containing_function (const struct block *); extern int block_inlined_p (const struct block *block); -extern int contained_in (const struct block *, const struct block *); +/* Return true if block A is lexically nested within block B, or if a + and b have the same pc range. Return false otherwise. If + ALLOW_NESTED is true, then block A is considered to be in block B + if A is in a nested function in B's function. If ALLOW_NESTED is + false (the default), then blocks in nested functions are not + considered to be contained. */ + +extern bool contained_in (const struct block *a, const struct block *b, + bool allow_nested = false); extern const struct blockvector *blockvector_for_pc (CORE_ADDR, const struct block **); -- cgit v1.1