diff options
author | Mark Wielaard <[email protected]> | 2017-12-20 16:50:57 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2017-12-20 17:20:29 +0100 |
commit | 51a7292b7ec7ddebcd2abddc7efff9d604494d44 (patch) | |
tree | 821f988774a107793b1d0f9978d58ce3651c7e97 /libdw/dwarf_getmacros.c | |
parent | 8887f30e55747b010631f04c4dc5f513359213f4 (diff) |
libdw: Add explicit section index to struct Dwarf_CU.
The DIE (attribute) data might come from either the main .debug_info
section or for DWARFv4 from a separate .debug_types section. Or in
case of the fake_loc_cu from the .debug_loc section and in the case
of macros from the .debug_macinfo or .debug_macro section.
We didn't handle the last two "fake" CU cases correctly when sanity
checking offsets in __libdw_read_address and __libdw_read_offset.
Add an explicit sec_idx field to struct Dwarf_CU that is always set
to the actual section that the data came from.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_getmacros.c')
-rw-r--r-- | libdw/dwarf_getmacros.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libdw/dwarf_getmacros.c b/libdw/dwarf_getmacros.c index db6582b6..c456051c 100644 --- a/libdw/dwarf_getmacros.c +++ b/libdw/dwarf_getmacros.c @@ -360,6 +360,7 @@ read_macros (Dwarf *dbg, int sec_index, Version 4 for the old GNU extension, version 5 for DWARF5. */ Dwarf_CU fake_cu = { .dbg = dbg, + .sec_idx = sec_index, .version = table->version, .offset_size = table->is_64bit ? 8 : 4, .startp = (void *) startp + offset, |