This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] DWARFv5 DW_TAG_aligned_type.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: gdb-patches at sourceware dot org, Tom Tromey <tromey at redhat dot com>
- Date: Fri, 11 Jul 2014 07:42:27 -0700
- Subject: Re: [PATCH] DWARFv5 DW_TAG_aligned_type.
- Authentication-results: sourceware.org; auth=none
- References: <1404944457-4500-1-git-send-email-mjw at redhat dot com>
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