From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54406 invoked by alias); 18 Jul 2018 17:18:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 54387 invoked by uid 89); 18 Jul 2018 17:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:f.i, f.i, dwarf2, translated X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Jul 2018 17:18:05 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5E74AAD77 for ; Wed, 18 Jul 2018 17:18:03 +0000 (UTC) Date: Wed, 18 Jul 2018 17:18:00 -0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC][PATCH][symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count Message-ID: <20180718171814.br2yfrfajkyk6i2j@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170912 (1.9.0) X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00559.txt.bz2 Hi, this patch (without test-case for now) generates a warning if DW_AT_upper_bound or DW_AT_count is defined, but can't be translated. This is triggered for current gcc in lto mode for vla test-cases. F.i.: ... $ gcc gcc/testsuite/gcc.dg/guality/vla-1.c -g -O2 -flto \ -DPREVENT_OPTIMIZATION -o ./vla-1.exe $ ./gdb -batch -ex "set complaints 10" -ex "file ./vla-1.exe" During symbol reading, Unresolved DW_AT_upper_bound - DIE at 0x337 [in module vla-1.exe]. ... Good idea? Any other comments? Thanks, - Tom [gdb/symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count 2018-07-18 Tom de Vries * dwarf2read.c (read_subrange_type): Warn if DW_AT_upper_bound or DW_AT_count can't be translated to a dynamic prop. --- gdb/dwarf2read.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b7933de49c..3f696ea060 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -17596,10 +17596,11 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) sect_offset_str (die->sect_off), objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); - attr = dwarf2_attr (die, DW_AT_upper_bound, cu); + struct attribute *attr_ub, *attr_count; + attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu); if (!attr_to_dynamic_prop (attr, die, cu, &high)) { - attr = dwarf2_attr (die, DW_AT_count, cu); + attr = attr_count = dwarf2_attr (die, DW_AT_count, cu); if (attr_to_dynamic_prop (attr, die, cu, &high)) { /* If bounds are constant do the final calculation here. */ @@ -17608,6 +17609,20 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) else high_bound_is_count = 1; } + else + { + if (attr_ub) + complaint (_("Unresolved DW_AT_upper_bound " + "- DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), + objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); + if (attr_count) + complaint (_("Unresolved DW_AT_count " + "- DIE at %s [in module %s]"), + sect_offset_str (die->sect_off), + objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); + } + } /* Dwarf-2 specifications explicitly allows to create subrange types