This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] append_composite_type_field_aligned
On 06/21/2011 05:47 PM, Andrew Burgess wrote:
> ping.
>
> If there's anything else I should do to help progress this then please
> let me know.
>
I can't see there is anything else you should do. Just wait for
maintainers to review this patch.
>> gdb/ChangeLog
>>
>> 2011-06-09 Andrew Burgess<aburgess@broadcom.com>
>>
>> * gdbtypes.c (append_composite_type_field_aligned): Fix
>> calculation of bit position based on alignment.
>>
>> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
>> index 2bdb4eb..ba957f9 100644
>> --- a/gdb/gdbtypes.c
>> +++ b/gdb/gdbtypes.c
>> @@ -3654,12 +3654,14 @@ append_composite_type_field_aligned (struct
>> type *t, char *name,
>>
>> if (alignment)
>> {
>> - int left = FIELD_BITPOS (f[0]) % (alignment *
>> TARGET_CHAR_BIT);
>> + int left;
>> + alignment *= TARGET_CHAR_BIT;
>> + left = FIELD_BITPOS (f[0]) % alignment;
>>
>> if (left)
>> {
>> - FIELD_BITPOS (f[0]) += left;
>> - TYPE_LENGTH (t) += left / TARGET_CHAR_BIT;
>> + FIELD_BITPOS (f[0]) += (alignment - left);
>> + TYPE_LENGTH (t) += (alignment - left) / TARGET_CHAR_BIT;
>> }
>> }
>> }
I am not the people to approve this. I read your patch, and it looks
correct.
--
Yao (éå)