diff options
Diffstat (limited to 'libdw/dwarf_nextcu.c')
-rw-r--r-- | libdw/dwarf_nextcu.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libdw/dwarf_nextcu.c b/libdw/dwarf_nextcu.c index 9e5a96bc..66cde78a 100644 --- a/libdw/dwarf_nextcu.c +++ b/libdw/dwarf_nextcu.c @@ -84,7 +84,8 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, /* This points into the .debug_info section to the beginning of the CU entry. */ - char *bytes = (char *) dwarf->sectiondata[IDX_debug_info]->d_buf + off; + unsigned char *data = dwarf->sectiondata[IDX_debug_info]->d_buf; + unsigned char *bytes = data + off; /* The format of the CU header is described in dwarf2p1 7.5.1: @@ -144,10 +145,10 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, /* Get offset in .debug_abbrev. Note that the size of the entry depends on whether this is a 32-bit or 64-bit DWARF definition. */ uint64_t abbrev_offset; - if (offset_size == 4) - abbrev_offset = read_4ubyte_unaligned_inc (dwarf, bytes); - else - abbrev_offset = read_8ubyte_unaligned_inc (dwarf, bytes); + if (__libdw_read_offset_inc (dwarf, IDX_debug_info, &bytes, offset_size, + &abbrev_offset, IDX_debug_abbrev, 0)) + return -1; + if (abbrev_offsetp != NULL) *abbrev_offsetp = abbrev_offset; @@ -162,9 +163,7 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp, /* Store the header length. */ if (header_sizep != NULL) - *header_sizep = (bytes - - ((char *) dwarf->sectiondata[IDX_debug_info]->d_buf - + off)); + *header_sizep = bytes - (data + off); /* See definition of DIE_OFFSET_FROM_CU_OFFSET macro for an explanation of the trick in this expression. */ |