From 988915ee7b880ff059f849893b71118d9bd2c4fc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 24 Apr 2019 12:50:04 -0600 Subject: Fix VLA printing for Ada While looking at a different Ada problem, I found that printing a record containing a VLA did not work properly. I tracked the problem down to dwarf2_evaluate_property trying, and failing, to compare two types that differed only in qualifiers. This patch changes dwarf2_evaluate_property to ignore qualifiers when comparing types. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-05-08 Tom Tromey * dwarf2loc.c (dwarf2_evaluate_property) : Compare main types. gdb/testsuite/ChangeLog 2019-05-08 Tom Tromey * gdb.ada/vla.exp: New file. * gdb.ada/vla/vla.adb: New file. --- gdb/dwarf2loc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gdb/dwarf2loc.c') diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index bd630ee..c5145af 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -2493,8 +2493,12 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, struct value *val; for (pinfo = addr_stack; pinfo != NULL; pinfo = pinfo->next) - if (pinfo->type == baton->referenced_type) - break; + { + /* This approach lets us avoid checking the qualifiers. */ + if (TYPE_MAIN_TYPE (pinfo->type) + == TYPE_MAIN_TYPE (baton->referenced_type)) + break; + } if (pinfo == NULL) error (_("cannot find reference address for offset property")); if (pinfo->valaddr != NULL) -- cgit v1.1