[PATCH] DWARFv5 DW_TAG_aligned_type.

Joel Brobecker brobecker@adacore.com
Fri Jul 11 15:23:00 GMT 2014


Hi Mark,

> gdb/ChangeLog
> 
> 	* c-typeprint.c (cp_type_print_method_args): Handle TYPE_USER_ALIGN.
> 	(c_type_print_varspec_prefix): Likewise.
> 	(c_type_print_modifier): Likewise.
> 	* dwarf2read.c (add_array_cv_aligned_type): New function.
> 	(read_tag_aligned_type): Likewise.
> 	(read_type_die_1): Handle DW_TAG_aligned_type.
> 	* gdbtypes.c (make_qualified_type): Calls...
> 	(make_qualified_aligned_type): New function that handles user
> 	alignment.
> 	(make_aligned_type): New function.
> 	(check_typedef): Handle TYPE_USER_ALIGN.
> 	(check_types_equal): Likewise.
> 	(recursive_dump_type): Likewise.
> 	(copy_type_recursive): Likewise.
> 	(copy_type): Likewise.
> 	* gdbtypes.h (struct type): Add user_align.
> 	(TYPE_USER_ALIGN): New define.
> 	(make_aligned_type): Define.

Thanks for the patch!

My only question is regarding the checks for alignments to be stricter
than the alignment of their base types. Why are they needed? I am asking
because, in Ada, it is allowed to be specifying an alignment which is
less strict than the standard alignment. We can ask for byte-aligned
integers, for instance. If I understand your patch correctly, the base
type will have no alignment attribute, and therefore the 1-byte
alignment attribute will be accepted. So my guess is that those checks
are implementing requirements of the proposed DWARF extension. This
leads me to ask why that's necessary? Shouldn't the compiler be able
to provide the actual alignement allowing consumers to just follow it
blindly?

Thanks!
-- 
Joel



More information about the Gdb-patches mailing list