This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] default_type_align: Use type_length_units
- From: Tom Tromey <tom at tromey dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>, Tom Tromey <tom at tromey dot com>
- Date: Thu, 14 Jun 2018 09:59:02 -0700
- Subject: Re: [PATCH] default_type_align: Use type_length_units
- References: <1528928623-27479-1-git-send-email-simon.marchi@ericsson.com>
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
Simon> The type alignment value is returned in 8-bit-bytes instead of target
Simon> memory addressable units. For example, on a target with 16-bit-bytes
Simon> where sizeof(int) == 1 (one addressable unit), alignof(int) currently
Simon> returns 2. After, this patch, it returns 1.
Simon> * arch-utils.c (default_type_align): Use type_length_units.
This certainly is correct according to the comment in gdbtypes.h:
/* * Return the alignment of the type in target addressable memory
units.
However, I was curious to know what DWARF specifies, to see whether
dwarf2read was doing this as well. But DWARF seems pretty silent on
this topic:
A debugging information entry may have a DW_AT_alignment attribute
whose value of class constant is a positive, non-zero, integer
describing the alignment of the entity.
So maybe this is depending on what your compiler does? I think I did
not really consider this issue too deeply when writing the alignment
support :(
Another possible issue is that gdbtypes.c:type_align uses TYPE_LENGTH in
one spot but I suppose it ought to use type_length_units if this patch
goes in.
Tom