Some of the structure types have members that are not stacked next to each other. Check out the structure type at 0x33E6 in bzip2_base (x86-64) here. There's an int at location offset 0, a char at 4 and then an int at 5004! and so on, which brings up the size of the struct to 5104 Bytes, although it only consists of int and char variables (3 of each) with a struct called strm which is 640 Bytes long.
1 Answer
The second member, called buf
(at location 4) is not a char
. The type of that member is defined at 0x3451
, and this is an array type. Its elements are each of the type defined at 0x2d04
, which is a typedef named Char
, which redirects to 0x29b7
, which is indeed char
(represented as base type signed char
).
<1><3451>: Abbrev Number: 11 (DW_TAG_array_type)
<3452> DW_AT_type : <0x2d04> ==> Char ==> (signed) char
<3456> DW_AT_sibling : <0x3462> ==> just management info
<2><345a>: Abbrev Number: 25 (DW_TAG_subrange_type)
<345b> DW_AT_type : <0x29a8> ==> indexed by "sizetype"
<345f> DW_AT_upper_bound : 4999 ==> indices are 0..4999
<2><3461>: Abbrev Number: 0
So the type of that member is an array containing 5000 Char
objects which are char
objects. So it is not surprising that when buf
starts at offset 4, the next object starts at offset 5004.