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] Remove TYPE_STUB_SUPPORTED, fix ICC opaque struct bug


I will apply this patch on 1/29/14 unless I hear an objection.

On 01/25/14 09:17, Michael Eager wrote:
This is a replacement for https://sourceware.org/ml/gdb-patches/2014-01/msg00146.html.

This patch removes TYPE_STUB_SUPPORTED and sets the
TYPE_STUB flag for opaque structs generated by ICC.
Some code cleanup as well.

2014-01-25  Michael Eager <eager@eagercon.com>

   * dwarf2read.c (read_structure_type): Remove TYPE_STUB_SUPPORTED, set
     TYPE_STUB correctly for ICC opaque structs.
   * gdbtypes.c (init_type, recursive_dump_type): Remove TYPE_STUB_SUPPORTED.
   * gdbtypes.h (TYPE_STUB_SUPPORTED, TYPE_IS_OPAQUE): Remove TYPE_STUB_SUPPORTED.


Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.844
diff -u -r1.844 dwarf2read.c
--- dwarf2read.c    16 Oct 2013 02:55:27 -0000    1.844
+++ dwarf2read.c    25 Jan 2014 17:11:22 -0000
@@ -12687,21 +12687,22 @@
        TYPE_LENGTH (type) = 0;
      }

-  if (producer_is_icc (cu))
+  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 (producer_is_realview (cu->producer)
+           && attr == NULL && die->child == NULL)
+    {
+      /* RealView does not output the required DW_AT_declaration
+         on incomplete types.  */
+      TYPE_STUB (type) = 1;
      }
-  else
-    TYPE_STUB_SUPPORTED (type) = 1;
-
-  if (die_is_declaration (die, cu))
-    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;

    /* We need to add the type field to the die immediately so we don't
       infinitely recurse when dealing with pointers to the structure
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.256
diff -u -r1.256 gdbtypes.c
--- gdbtypes.c    17 Oct 2013 13:28:37 -0000    1.256
+++ gdbtypes.c    25 Jan 2014 17:11:22 -0000
@@ -2000,8 +2000,6 @@
      TYPE_VARARGS (type) = 1;
    if (flags & TYPE_FLAG_VECTOR)
      TYPE_VECTOR (type) = 1;
-  if (flags & TYPE_FLAG_STUB_SUPPORTED)
-    TYPE_STUB_SUPPORTED (type) = 1;
    if (flags & TYPE_FLAG_FIXED_INSTANCE)
      TYPE_FIXED_INSTANCE (type) = 1;
    if (flags & TYPE_FLAG_GNU_IFUNC)
@@ -3288,10 +3286,6 @@
      {
        puts_filtered (" TYPE_FIXED_INSTANCE");
      }
-  if (TYPE_STUB_SUPPORTED (type))
-    {
-      puts_filtered (" TYPE_STUB_SUPPORTED");
-    }
    if (TYPE_NOTTEXT (type))
      {
        puts_filtered (" TYPE_NOTTEXT");
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.182
diff -u -r1.182 gdbtypes.h
--- gdbtypes.h    17 Oct 2013 13:28:37 -0000    1.182
+++ gdbtypes.h    25 Jan 2014 17:11:22 -0000
@@ -271,13 +271,6 @@

  #define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance)

-/* This debug target supports TYPE_STUB(t).  In the unsupported case we have to
-   rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE ().
-   TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed
-   the TYPE_STUB(t) value (see dwarfread.c).  */
-
-#define TYPE_STUB_SUPPORTED(t)   (TYPE_MAIN_TYPE (t)->flag_stub_supported)
-
  /* Not textual.  By default, GDB treats all single byte integers as
     characters (or elements of strings) unless this flag is set.  */

@@ -1246,7 +1239,7 @@
     && (TYPE_NFIELDS (thistype) == 0) \
     && (!HAVE_CPLUS_STRUCT (thistype) \
         || TYPE_NFN_FIELDS (thistype) == 0) \
-   && (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype)))
+   && TYPE_STUB (thistype))

  /* A helper macro that returns the name of a type or "unnamed type" if the type
     has no name.  */



--
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


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