[Midnightbsd-cvs] src [7784] trunk/contrib/gdb/gdb: clang/ llvm now emits D_TAG_restrict_type which wasn't handled by gdb.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 5 12:28:00 EDT 2016


Revision: 7784
          http://svnweb.midnightbsd.org/src/?rev=7784
Author:   laffer1
Date:     2016-09-05 12:27:59 -0400 (Mon, 05 Sep 2016)
Log Message:
-----------
clang/llvm now emits D_TAG_restrict_type which wasn't handled by gdb.

Import apple's gdb-1822

Obtained from: Apple

Modified Paths:
--------------
    trunk/contrib/gdb/gdb/dwarf2read.c
    trunk/contrib/gdb/gdb/gdbtypes.c
    trunk/contrib/gdb/gdb/gdbtypes.h
    trunk/contrib/gdb/gdb/hpread.c
    trunk/contrib/gdb/gdb/parse.c
    trunk/contrib/gdb/gdb/stabsread.c

Modified: trunk/contrib/gdb/gdb/dwarf2read.c
===================================================================
--- trunk/contrib/gdb/gdb/dwarf2read.c	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/dwarf2read.c	2016-09-05 16:27:59 UTC (rev 7784)
@@ -834,6 +834,8 @@
 
 static void read_tag_volatile_type (struct die_info *, struct dwarf2_cu *);
 
+static void read_tag_restrict_type (struct die_info *, struct dwarf2_cu *);
+
 static void read_tag_string_type (struct die_info *, struct dwarf2_cu *);
 
 static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
@@ -3729,7 +3731,8 @@
     }
 
   base_type = die_type (die, cu);
-  die->type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
+  die->type = make_cvr_type (1, TYPE_VOLATILE (base_type),
+                             TYPE_RESTRICT (base_type), base_type, 0);
 }
 
 static void
@@ -3743,9 +3746,25 @@
     }
 
   base_type = die_type (die, cu);
-  die->type = make_cv_type (TYPE_CONST (base_type), 1, base_type, 0);
+  die->type = make_cvr_type (TYPE_CONST (base_type), 1,
+                             TYPE_RESTRICT (base_type), base_type, 0);
 }
 
+static void
+read_tag_restrict_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+  struct type *base_type;
+
+  if (die->type)
+    {
+      return;
+    }
+
+  base_type = die_type (die, cu);
+  die->type = make_cvr_type (TYPE_CONST (base_type), TYPE_VOLATILE (base_type),
+                             1, base_type, 0);
+}
+
 /* Extract all information from a DW_TAG_string_type DIE and add to
    the user defined type vector.  It isn't really a user defined type,
    but it behaves like one, with other DIE's using an AT_user_def_type
@@ -6083,6 +6102,9 @@
     case DW_TAG_volatile_type:
       read_tag_volatile_type (die, cu);
       break;
+    case DW_TAG_restrict_type:
+      read_tag_restrict_type (die, cu);
+      break;
     case DW_TAG_string_type:
       read_tag_string_type (die, cu);
       break;

Modified: trunk/contrib/gdb/gdb/gdbtypes.c
===================================================================
--- trunk/contrib/gdb/gdb/gdbtypes.c	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/gdbtypes.c	2016-09-05 16:27:59 UTC (rev 7784)
@@ -502,7 +502,8 @@
    We allocate new memory if needed.  */
 
 struct type *
-make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
+make_cvr_type (int cnst, int voltl, int restrct, struct type *type,
+               struct type **typeptr)
 {
   struct type *ntype;	/* New type */
   struct type *tmp_type = type;	/* tmp type */
@@ -517,6 +518,9 @@
   if (voltl)
     new_flags |= TYPE_FLAG_VOLATILE;
 
+  if (restrct)
+    new_flags |= TYPE_FLAG_RESTRICT;
+
   if (typeptr && *typeptr != NULL)
     {
       /* Objfile is per-core-type.  This const-qualified type had best
@@ -1371,7 +1375,7 @@
 check_typedef (struct type *type)
 {
   struct type *orig_type = type;
-  int is_const, is_volatile;
+  int is_const, is_volatile, is_restrict;
 
   while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
     {
@@ -1407,6 +1411,7 @@
 
   is_const = TYPE_CONST (type);
   is_volatile = TYPE_VOLATILE (type);
+  is_restrict = TYPE_RESTRICT (type);
 
   /* If this is a struct/class/union with no fields, then check whether a
      full definition exists somewhere else.  This is for systems where a
@@ -1424,7 +1429,7 @@
 	}
       newtype = lookup_transparent_type (name);
       if (newtype)
-	make_cv_type (is_const, is_volatile, newtype, &type);
+	make_cvr_type (is_const, is_volatile, is_restrict, newtype, &type);
     }
   /* Otherwise, rely on the stub flag being set for opaque/stubbed types */
   else if (TYPE_STUB (type) && !currently_reading_symtab)
@@ -1442,7 +1447,8 @@
 	}
       sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0, (struct symtab **) NULL);
       if (sym)
-	make_cv_type (is_const, is_volatile, SYMBOL_TYPE (sym), &type);
+	make_cvr_type (is_const, is_volatile, is_restrict, SYMBOL_TYPE (sym),
+                       &type);
     }
 
   if (TYPE_TARGET_STUB (type))

Modified: trunk/contrib/gdb/gdb/gdbtypes.h
===================================================================
--- trunk/contrib/gdb/gdb/gdbtypes.h	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/gdbtypes.h	2016-09-05 16:27:59 UTC (rev 7784)
@@ -273,6 +273,13 @@
 #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
 				   & TYPE_FLAG_ADDRESS_CLASS_ALL)
 
+/* Restrict type.  If this is set, the corresponding type has a
+ * restrict modifier.
+ */
+
+#define TYPE_FLAG_RESTRICT (1 << 17)
+#define TYPE_RESTRICT(t)	(TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_RESTRICT)
+
 /*  Array bound type.  */
 enum array_bound_type
 {
@@ -1099,7 +1106,8 @@
 
 extern struct type *make_reference_type (struct type *, struct type **);
 
-extern struct type *make_cv_type (int, int, struct type *, struct type **);
+extern struct type *make_cvr_type (int, int, int, struct type *,
+                                   struct type **);
 
 extern void replace_type (struct type *, struct type *);
 

Modified: trunk/contrib/gdb/gdb/hpread.c
===================================================================
--- trunk/contrib/gdb/gdb/hpread.c	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/hpread.c	2016-09-05 16:27:59 UTC (rev 7784)
@@ -4939,8 +4939,9 @@
        * "m_void" modifiers?  Is static_flag really needed here?
        * (m_static used for methods of classes, elsewhere).
        */
-      tmp_type = make_cv_type (dn_bufp->dmodifier.m_const,
+      tmp_type = make_cvr_type (dn_bufp->dmodifier.m_const,
 			       dn_bufp->dmodifier.m_volatile,
+                               0,
 		      hpread_type_lookup (dn_bufp->dmodifier.type, objfile),
 			       0);
       return tmp_type;

Modified: trunk/contrib/gdb/gdb/parse.c
===================================================================
--- trunk/contrib/gdb/gdb/parse.c	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/parse.c	2016-09-05 16:27:59 UTC (rev 7784)
@@ -1167,13 +1167,15 @@
       case tp_end:
 	done = 1;
 	if (make_const)
-	  follow_type = make_cv_type (make_const, 
-				      TYPE_VOLATILE (follow_type), 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (make_const,
+				       TYPE_VOLATILE (follow_type),
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_volatile)
-	  follow_type = make_cv_type (TYPE_CONST (follow_type), 
-				      make_volatile, 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (TYPE_CONST (follow_type),
+				       make_volatile,
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_addr_space)
 	  follow_type = make_type_with_address_space (follow_type, 
 						      make_addr_space);
@@ -1192,13 +1194,15 @@
       case tp_pointer:
 	follow_type = lookup_pointer_type (follow_type);
 	if (make_const)
-	  follow_type = make_cv_type (make_const, 
-				      TYPE_VOLATILE (follow_type), 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (make_const,
+				       TYPE_VOLATILE (follow_type),
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_volatile)
-	  follow_type = make_cv_type (TYPE_CONST (follow_type), 
-				      make_volatile, 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (TYPE_CONST (follow_type),
+				       make_volatile,
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_addr_space)
 	  follow_type = make_type_with_address_space (follow_type, 
 						      make_addr_space);
@@ -1208,13 +1212,15 @@
       case tp_reference:
 	follow_type = lookup_reference_type (follow_type);
 	if (make_const)
-	  follow_type = make_cv_type (make_const, 
-				      TYPE_VOLATILE (follow_type), 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (make_const,
+				       TYPE_VOLATILE (follow_type),
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_volatile)
-	  follow_type = make_cv_type (TYPE_CONST (follow_type), 
-				      make_volatile, 
-				      follow_type, 0);
+	  follow_type = make_cvr_type (TYPE_CONST (follow_type),
+				       make_volatile,
+				       TYPE_RESTRICT (follow_type),
+				       follow_type, 0);
 	if (make_addr_space)
 	  follow_type = make_type_with_address_space (follow_type, 
 						      make_addr_space);

Modified: trunk/contrib/gdb/gdb/stabsread.c
===================================================================
--- trunk/contrib/gdb/gdb/stabsread.c	2016-09-05 16:24:20 UTC (rev 7783)
+++ trunk/contrib/gdb/gdb/stabsread.c	2016-09-05 16:27:59 UTC (rev 7784)
@@ -1750,13 +1750,13 @@
 
     case 'k':			/* Const qualifier on some type (Sun) */
       type = read_type (pp, objfile);
-      type = make_cv_type (1, TYPE_VOLATILE (type), type,
+      type = make_cvr_type (1, TYPE_VOLATILE (type), TYPE_RESTRICT(type), type,
 			   dbx_lookup_type (typenums));
       break;
 
     case 'B':			/* Volatile qual on some type (Sun) */
       type = read_type (pp, objfile);
-      type = make_cv_type (TYPE_CONST (type), 1, type,
+      type = make_cvr_type (TYPE_CONST (type), 1, TYPE_RESTRICT(type), type,
 			   dbx_lookup_type (typenums));
       break;
 



More information about the Midnightbsd-cvs mailing list