[RFA/RFC/dwarf] detect 0xffffffff size attribute values

Joel Brobecker brobecker@adacore.com
Thu Jun 26 20:11:00 GMT 2008


Hi Daniel,

> > 2008-06-19  Joel Brobecker  <brobecker@adacore.com>
> > 
> >         * dwarf2read.c (read_attribute_value): Treat size attribute
> >         values of 0xffffffff as if the attribute value was zero.
> 
> OK.  A complaint when this happens wouldn't be a bad thing, either.

Thanks for the review. I am not 100% sure about the complaint, because
I presume that this issue happens on a routine basis whenever record
types (the equivalent of structs) whose size is dynamic are used.
If they are frequent, my concern is that the complaint mechanism would
be shut down by several repetitions of the same complaint before giving
other complaints a chance to print their message? Perhaps we could
decide to define a new complaint category, instead of using the symtab
category?  In the meantime, I checked the initial patch in, and started
testing the following patch:

2008-06-26  Joel Brobecker  <brobecker@adacore.com>

        * dwarf2read.c (read_attribute_value): Issue a complaint when
        adjusting size attribute values of 0xffffffff as zero.

WDYT?

-- 
Joel
-------------- next part --------------
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.266
diff -u -p -r1.266 dwarf2read.c
--- dwarf2read.c	26 Jun 2008 19:08:10 -0000	1.266
+++ dwarf2read.c	26 Jun 2008 19:25:09 -0000
@@ -6244,7 +6244,13 @@ read_attribute_value (struct attribute *
   if (attr->name == DW_AT_byte_size
       && form == DW_FORM_data4
       && DW_UNSND (attr) >= 0xffffffff)
-    DW_UNSND (attr) = 0;
+    {
+      complaint
+        (&symfile_complaints,
+         _("Suspicious DW_AT_byte_size value treated as zero instead of %lx"),
+         DW_UNSND (attr));
+      DW_UNSND (attr) = 0;
+    }
 
   return info_ptr;
 }


More information about the Gdb-patches mailing list