Blame SOURCES/valgrind-3.14.0-subrange_type-count.patch

7a6b42
commit 3528f84037833a799538a2fc48ed30dd09c77b5e
7a6b42
Author: Mark Wielaard <mark@klomp.org>
7a6b42
Date:   Fri Jan 11 21:52:26 2019 +0100
7a6b42
7a6b42
    readdwarf3.c (parse_type_DIE): Accept DW_TAG_subrange_type with DW_AT_count
7a6b42
    
7a6b42
    GCC9 generates a subrange_type with a lower_bound and count, but no
7a6b42
    upper_bound attribute. This simply means the upper bound is lower
7a6b42
    plus count.
7a6b42
7a6b42
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
7a6b42
index e9a3816..1b49ba4 100644
7a6b42
--- a/coregrind/m_debuginfo/readdwarf3.c
7a6b42
+++ b/coregrind/m_debuginfo/readdwarf3.c
7a6b42
@@ -3610,6 +3610,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
7a6b42
       Bool have_count = False;
7a6b42
       Long lower = 0;
7a6b42
       Long upper = 0;
7a6b42
+      Long count = 0;
7a6b42
 
7a6b42
       switch (parser->language) {
7a6b42
          case 'C': have_lower = True;  lower = 0; break;
7a6b42
@@ -3641,7 +3642,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
7a6b42
             have_upper = True;
7a6b42
          }
7a6b42
          if (attr == DW_AT_count && cts.szB > 0) {
7a6b42
-            /*count    = (Long)cts.u.val;*/
7a6b42
+            count    = (Long)cts.u.val;
7a6b42
             have_count = True;
7a6b42
          }
7a6b42
       }
7a6b42
@@ -3680,6 +3681,11 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
7a6b42
          boundE.Te.Bound.knownU = False;
7a6b42
          boundE.Te.Bound.boundL = 0;
7a6b42
          boundE.Te.Bound.boundU = 0;
7a6b42
+      } else if (have_lower && (!have_upper) && (have_count)) {
7a6b42
+         boundE.Te.Bound.knownL = True;
7a6b42
+         boundE.Te.Bound.knownU = True;
7a6b42
+         boundE.Te.Bound.boundL = lower;
7a6b42
+         boundE.Te.Bound.boundU = lower + count;
7a6b42
       } else {
7a6b42
          /* FIXME: handle more cases */
7a6b42
          goto_bad_DIE;