Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [RFC][PATCH][symtab] Warn about unresolved DW_AT_upper_bound/DW_AT_count
Date: Wed, 18 Jul 2018 17:18:00 -0000	[thread overview]
Message-ID: <20180718171814.br2yfrfajkyk6i2j@delia> (raw)

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  <tdevries@suse.de>

	* 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


             reply	other threads:[~2018-07-18 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18 17:18 Tom de Vries [this message]
2018-07-19 14:40 ` Tom Tromey
2018-07-20 21:21   ` Tom de Vries
2018-07-25 18:55     ` Tom Tromey
2018-07-26  8:40       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180718171814.br2yfrfajkyk6i2j@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox