This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] default_type_align: Use type_length_units


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]