Project

General

Profile

Bug #17052 ยป ruby-addr2line-debug_info_read-debug-code-0001.patch

Debug code for `debug_info_read` - xtkoba (Tee KOBAYASHI), 08/19/2021 12:51 PM

View differences:

addr2line.c
1266 1266
{
1267 1267
    const char *p = reader->abbrev_table[abbrev_number];
1268 1268
    if (!p) {
1269
        fprintf(stderr,"%d: Abbrev Number %"PRId64" not found\n",__LINE__, abbrev_number);
1269
        uint64_t a = abbrev_number;
1270
        ptrdiff_t len = 0;
1271
        while (a) {
1272
            len++;
1273
            a >>= 7;
1274
        }
1275
        fprintf(stderr,"%d: debug_info 0x%"PRIxPTR" Abbrev Number %"PRId64" not found\n",__LINE__, reader->p - reader->obj->debug_info.ptr - len, abbrev_number);
1270 1276
        abort();
1271 1277
    }
1272 1278
    return p;
......
1728 1734
            }
1729 1735
        }
1730 1736
    }
1737
    /* assert(reader->p >= reader->cu_end); */
1738
    ptrdiff_t p_rel = reader->p - reader->obj->debug_info.ptr;
1739
    ptrdiff_t cu_end_rel = reader->cu_end - reader->obj->debug_info.ptr;
1740
    if (reader->p > reader->cu_end) {
1741
        fprintf(stderr,"%d: debug_info CU over-read 0x%"PRIxPTR" > 0x%"PRIxPTR"\n",__LINE__, p_rel, cu_end_rel);
1742
        abort();
1743
    }
1744
    /* assert(reader->p == reader->cu_end); */
1731 1745
}
1732 1746

  
1733 1747
#ifdef USE_ELF