diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-12-22 00:51:46 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2022-12-22 18:57:06 +0900 |
commit | 78826ad4868c56964d0c47cf37f0100565a5b997 (patch) | |
tree | a3643b15167a61c81044051b6775aaefda767f29 /addr2line.c | |
parent | c827d724b767a4624b9a3a00c61f181aaf6aef7e (diff) | |
download | ruby-78826ad4868c56964d0c47cf37f0100565a5b997.tar.gz |
addr2info.c: Make it work with --enable-yjit
Background: GCC 12 generates DWARF 5 with .debug_rnglists, while rustc
generates DWARF 4 with .debug_ranges.
The previous logic always used .debug_rnglists if there is the section.
However, we need to refer .debug_ranges for DWARF 4.
This change keeps DWARF version of the current compilation unit and use
a proper section depending on the version.
Diffstat (limited to 'addr2line.c')
-rw-r--r-- | addr2line.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addr2line.c b/addr2line.c index 271795aea5..7c3728f476 100644 --- a/addr2line.c +++ b/addr2line.c @@ -863,6 +863,7 @@ enum { typedef struct { obj_info_t *obj; const char *file; + uint8_t current_version; const char *current_cu; uint64_t current_low_pc; const char *debug_line_cu_end; @@ -1472,7 +1473,7 @@ ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) 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->current_version >= 5) { p = reader->obj->debug_rnglists.ptr + ptr->ranges; for (;;) { uint8_t rle = read_uint8(&p); @@ -1583,6 +1584,7 @@ di_read_cu(DebugInfoReader *reader) } reader->cu_end = reader->p + unit_length; version = read_uint16(&reader->p); + reader->current_version = version; if (version > 5) { return -1; } |