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] Fix check for ICC incomplete struct types


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


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