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.
This commit is contained in:
parent
c827d724b7
commit
78826ad486
Notes:
git
2022-12-22 09:57:24 +00:00
@ -863,6 +863,7 @@ enum {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
obj_info_t *obj;
|
obj_info_t *obj;
|
||||||
const char *file;
|
const char *file;
|
||||||
|
uint8_t current_version;
|
||||||
const char *current_cu;
|
const char *current_cu;
|
||||||
uint64_t current_low_pc;
|
uint64_t current_low_pc;
|
||||||
const char *debug_line_cu_end;
|
const char *debug_line_cu_end;
|
||||||
@ -1472,7 +1473,7 @@ ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr)
|
|||||||
const char *p;
|
const char *p;
|
||||||
uint64_t base = ptr->low_pc_set ? ptr->low_pc : reader->current_low_pc;
|
uint64_t base = ptr->low_pc_set ? ptr->low_pc : reader->current_low_pc;
|
||||||
bool base_valid = true;
|
bool base_valid = true;
|
||||||
if (reader->obj->debug_rnglists.ptr) {
|
if (reader->current_version >= 5) {
|
||||||
p = reader->obj->debug_rnglists.ptr + ptr->ranges;
|
p = reader->obj->debug_rnglists.ptr + ptr->ranges;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
uint8_t rle = read_uint8(&p);
|
uint8_t rle = read_uint8(&p);
|
||||||
@ -1583,6 +1584,7 @@ di_read_cu(DebugInfoReader *reader)
|
|||||||
}
|
}
|
||||||
reader->cu_end = reader->p + unit_length;
|
reader->cu_end = reader->p + unit_length;
|
||||||
version = read_uint16(&reader->p);
|
version = read_uint16(&reader->p);
|
||||||
|
reader->current_version = version;
|
||||||
if (version > 5) {
|
if (version > 5) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user