This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix check for ICC incomplete struct types
- From: Tom Tromey <tromey at redhat dot com>
- To: Michael Eager <eager at eagerm dot com>
- Cc: "gdb-patches\ at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Tue, 07 Jan 2014 11:43:48 -0700
- Subject: Re: [PATCH] Fix check for ICC incomplete struct types
- Authentication-results: sourceware.org; auth=none
- References: <52CC3790 dot 4030702 at eagerm dot com>
>>>>> "Michael" == Michael Eager <eager@eagerm.com> writes:
Michael> GDB contains code in read_structure_type() which is supposed
Michael> to check for incorrect DWARF generated by ICC for an incomplete
Michael> structure type. The code is incomplete, in that it doesn't
Michael> check for length == 0, and it doesn't set the STUB flag.
Thanks.
Michael> - if (producer_is_icc (cu))
Michael> + if (producer_is_icc (cu) && (TYPE_LENGTH (type) == 0))
Michael> {
Michael> /* ICC does not output the required DW_AT_declaration
Michael> on incomplete types, but gives them a size of zero. */
Michael> + TYPE_STUB (type) = 1;
Michael> }
Michael> else
Michael> TYPE_STUB_SUPPORTED (type) = 1;
It seems to me that TYPE_STUB_SUPPORTED should be set unconditionally
(and, btw, eww, what a big hack TYPE_STUB_SUPPORTED is). Without the
TYPE_STUB_SUPPORTED setting, TYPE_IS_OPAQUE does not honor TYPE_STUB.
Then the icc check moved to the next stanza, say like:
TYPE_STUB_SUPPORTED (type) = 1;
if (die_is_declaration (die, cu))
TYPE_STUB (type) = 1;
else if (producer_is_icc (cu) && TYPE_LENGTH (type) == 0)
{
/* ICC does not output the required DW_AT_declaration
on incomplete types, but gives them a size of zero. */
TYPE_STUB (type) = 1;
}
else if (attr == NULL && die->child == NULL
&& producer_is_realview (cu->producer))
/* RealView does not output the required DW_AT_declaration
on incomplete types. */
TYPE_STUB (type) = 1;
What do you think of this?
Tom