Project

General

Profile

Bug #18081 ยป ruby-addr2line-section-for-DW_AT_ranges.patch

addr2line.c: Correct section for `DW_AT_ranges` - xtkoba (Tee KOBAYASHI), 08/17/2021 02:02 PM

View differences:

addr2line.c
const char *pend;
const char *q0;
const char *q;
uint16_t version;
int format; // 4 or 8
uint8_t address_size;
uint64_t debug_abbrev_offset;
......
const char *p;
uint64_t base = ptr->low_pc_set ? ptr->low_pc : reader->current_low_pc;
bool base_valid = true;
if (reader->obj->debug_rnglists.ptr) {
if (reader->version >= 5) {
if (!reader->obj->debug_rnglists.ptr) {
return false;
}
p = reader->obj->debug_rnglists.ptr + ptr->ranges;
for (;;) {
uint8_t rle = read_uint8(&p);
......
}
return false;
}
/* assert(reader->version < 5); */
if (!reader->obj->debug_ranges.ptr) {
return false;
}
p = reader->obj->debug_ranges.ptr + ptr->ranges;
for (;;) {
uintptr_t from = read_uintptr(&p);
......
di_read_cu(DebugInfoReader *reader)
{
uint64_t unit_length;
uint16_t version;
reader->format = 4;
reader->current_cu = reader->p;
unit_length = read_uint32(&reader->p);
......
reader->format = 8;
}
reader->cu_end = reader->p + unit_length;
version = read_uint16(&reader->p);
if (version > 5) {
reader->version = read_uint16(&reader->p);
if (reader->version > 5) {
return -1;
}
else if (version == 5) {
else if (reader->version == 5) {
/* unit_type = */ read_uint8(&reader->p);
reader->address_size = read_uint8(&reader->p);
reader->debug_abbrev_offset = read_uint(reader);
    (1-1/1)