Project

General

Profile

Bug #17585 ยป ruby-addr2line-dwarf5.patch

xtkoba (Tee KOBAYASHI), 02/05/2021 05:12 AM

View differences:

addr2line.c
962 962
}
963 963

  
964 964
static void
965
di_skip_die_attributes(char **p)
966
{
967
    for (;;) {
968
        uint64_t at = uleb128(p);
969
        uint64_t form = uleb128(p);
970
        if (!at && !form) break;
971
        switch (form) {
972
          default:
973
            break;
974
          case DW_FORM_implicit_const:
975
            sleb128(p);
976
            break;
977
         }
978
    }
979
}
980

  
981
static void
965 982
di_read_debug_abbrev_cu(DebugInfoReader *reader)
966 983
{
967 984
    uint64_t prev = 0;
......
975 992
        prev = abbrev_number;
976 993
        uleb128(&p); /* tag */
977 994
        p++; /* has_children */
978
        /* skip content */
979
        for (;;) {
980
            uint64_t at = uleb128(&p);
981
            uint64_t form = uleb128(&p);
982
            if (!at && !form) break;
983
        }
995
        di_skip_die_attributes(&p);
984 996
    }
985 997
}
986 998

  
......
1244 1256
    /* skip 255th record */
1245 1257
    uleb128(&p); /* tag */
1246 1258
    p++; /* has_children */
1247
    /* skip content */
1248
    for (;;) {
1249
        uint64_t at = uleb128(&p);
1250
        uint64_t form = uleb128(&p);
1251
        if (!at && !form) break;
1252
    }
1259
    di_skip_die_attributes(&p);
1253 1260
    for (uint64_t n = uleb128(&p); abbrev_number != n; n = uleb128(&p)) {
1254 1261
        if (n == 0) {
1255 1262
            fprintf(stderr,"%d: Abbrev Number %"PRId64" not found\n",__LINE__, abbrev_number);
......
1257 1264
        }
1258 1265
        uleb128(&p); /* tag */
1259 1266
        p++; /* has_children */
1260
        /* skip content */
1261
        for (;;) {
1262
            uint64_t at = uleb128(&p);
1263
            uint64_t form = uleb128(&p);
1264
            if (!at && !form) break;
1265
        }
1267
        di_skip_die_attributes(&p);
1266 1268
    }
1267 1269
    return p;
1268 1270
}
......
1586 1588
              case DW_AT_ranges:
1587 1589
                ranges_set(&ranges, &v);
1588 1590
                break;
1591
              case DW_AT_entry_pc:
1592
                goto skip_die;
1589 1593
              case DW_AT_declaration:
1590 1594
                goto skip_die;
1591 1595
              case DW_AT_inline: