summaryrefslogtreecommitdiff
path: root/libdw/dwarf_begin_elf.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-12-20 16:50:57 +0100
committerMark Wielaard <mark@klomp.org>2017-12-20 17:20:29 +0100
commit51a7292b7ec7ddebcd2abddc7efff9d604494d44 (patch)
tree821f988774a107793b1d0f9978d58ce3651c7e97 /libdw/dwarf_begin_elf.c
parent8887f30e55747b010631f04c4dc5f513359213f4 (diff)
downloadelfutils-51a7292b7ec7ddebcd2abddc7efff9d604494d44.tar.gz
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 <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_begin_elf.c')
-rw-r--r--libdw/dwarf_begin_elf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index afa15cef..7c3fe103 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -201,6 +201,7 @@ valid_p (Dwarf *result)
}
else
{
+ result->fake_loc_cu->sec_idx = IDX_debug_loc;
result->fake_loc_cu->dbg = result;
result->fake_loc_cu->startp
= result->sectiondata[IDX_debug_loc]->d_buf;