]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
readdwarf3.c (parse_type_DIE): Accept DW_TAG_subrange_type with DW_AT_count
authorMark Wielaard <mark@klomp.org>
Fri, 11 Jan 2019 20:52:26 +0000 (21:52 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 11 Jan 2019 20:52:58 +0000 (21:52 +0100)
GCC9 generates a subrange_type with a lower_bound and count, but no
upper_bound attribute. This simply means the upper bound is lower
plus count.

coregrind/m_debuginfo/readdwarf3.c

index e9a3816a58472b58a968737417c439ee03eaa151..1b49ba4a181ab5ee1f1cba7bb2799c446f6a9b26 100644 (file)
@@ -3610,6 +3610,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
       Bool have_count = False;
       Long lower = 0;
       Long upper = 0;
+      Long count = 0;
 
       switch (parser->language) {
          case 'C': have_lower = True;  lower = 0; break;
@@ -3641,7 +3642,7 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
             have_upper = True;
          }
          if (attr == DW_AT_count && cts.szB > 0) {
-            /*count    = (Long)cts.u.val;*/
+            count    = (Long)cts.u.val;
             have_count = True;
          }
       }
@@ -3680,6 +3681,11 @@ static void parse_type_DIE ( /*MOD*/XArray* /* of TyEnt */ tyents,
          boundE.Te.Bound.knownU = False;
          boundE.Te.Bound.boundL = 0;
          boundE.Te.Bound.boundU = 0;
+      } else if (have_lower && (!have_upper) && (have_count)) {
+         boundE.Te.Bound.knownL = True;
+         boundE.Te.Bound.knownU = True;
+         boundE.Te.Bound.boundL = lower;
+         boundE.Te.Bound.boundU = lower + count;
       } else {
          /* FIXME: handle more cases */
          goto_bad_DIE;