Blame SOURCES/gdb-rhbz1320945-float128-3of9.patch

2c2fa1
commit 88dfca6c43c11dea69db24cfb87e6821e63e29b2
2c2fa1
Author: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
Date:   Tue Sep 6 17:26:32 2016 +0200
2c2fa1
2c2fa1
    Add some missing arch_..._type helpers
2c2fa1
    
2c2fa1
    gdbtypes provides a number of helper routines that can be called instead of
2c2fa1
    using arch_type directly to create a type of a particular kind.  This patch
2c2fa1
    adds two additional such routines that have been missing so far, to allow
2c2fa1
    creation of TYPE_CODE_DECFLOAT and TYPE_CODE_POINTER types.
2c2fa1
    
2c2fa1
    The patch also changes a number of places to use the new helper routines
2c2fa1
    instead of calling arch_type directly.  No functional change intended.
2c2fa1
    
2c2fa1
    gdb/ChangeLog:
2c2fa1
    
2c2fa1
            * gdbtypes.h (arch_decfloat_type): New prototype.
2c2fa1
            (arch_pointer_type): Likewise.
2c2fa1
            * gdbtypes.c (arch_decfloat_type): New function.
2c2fa1
            (arch_pointer_type): Likewise.
2c2fa1
            (gdbtypes_post_init): Use arch_decfloat_type.
2c2fa1
            * avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type.
2c2fa1
            * ft32-tdep.c (ft32_gdbarch_init): Likewise.
2c2fa1
            * m32c-tdep.c (make_types): Likewise.
2c2fa1
            * rl78-tdep.c (rl78_gdbarch_init): Likewise.
2c2fa1
    
2c2fa1
    Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2c2fa1
2c2fa1
### a/gdb/ChangeLog
2c2fa1
### b/gdb/ChangeLog
2c2fa1
## -1,5 +1,17 @@
2c2fa1
 2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
 
2c2fa1
+	* gdbtypes.h (arch_decfloat_type): New prototype.
2c2fa1
+	(arch_pointer_type): Likewise.
2c2fa1
+	* gdbtypes.c (arch_decfloat_type): New function.
2c2fa1
+	(arch_pointer_type): Likewise.
2c2fa1
+	(gdbtypes_post_init): Use arch_decfloat_type.
2c2fa1
+	* avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type.
2c2fa1
+	* ft32-tdep.c (ft32_gdbarch_init): Likewise.
2c2fa1
+	* m32c-tdep.c (make_types): Likewise.
2c2fa1
+	* rl78-tdep.c (rl78_gdbarch_init): Likewise.
2c2fa1
+
2c2fa1
+2016-09-05  Ulrich Weigand  <uweigand@de.ibm.com>
2c2fa1
+
2c2fa1
 	* gdbtypes.c (set_type_code): New function.
2c2fa1
 	(init_type, arch_type): Use it.
2c2fa1
 
2c2fa1
Index: gdb-7.6.1/gdb/avr-tdep.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/avr-tdep.c	2017-03-11 21:27:41.914206796 +0100
2c2fa1
+++ gdb-7.6.1/gdb/avr-tdep.c	2017-03-11 21:27:46.928242088 +0100
2c2fa1
@@ -1390,9 +1390,8 @@
2c2fa1
      be defined.  */
2c2fa1
   tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void");
2c2fa1
   tdep->func_void_type = make_function_type (tdep->void_type, NULL);
2c2fa1
-  tdep->pc_type = arch_type (gdbarch, TYPE_CODE_PTR, 4, NULL);
2c2fa1
-  TYPE_TARGET_TYPE (tdep->pc_type) = tdep->func_void_type;
2c2fa1
-  TYPE_UNSIGNED (tdep->pc_type) = 1;
2c2fa1
+  tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
2c2fa1
+				     tdep->func_void_type);
2c2fa1
 
2c2fa1
   set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
2c2fa1
   set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
2c2fa1
Index: gdb-7.6.1/gdb/gdbtypes.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/gdbtypes.c	2017-03-11 21:27:41.914206796 +0100
2c2fa1
+++ gdb-7.6.1/gdb/gdbtypes.c	2017-03-11 21:29:16.324862413 +0100
2c2fa1
@@ -3932,7 +3932,7 @@
2c2fa1
 
2c2fa1
 struct type *
2c2fa1
 arch_type (struct gdbarch *gdbarch,
2c2fa1
-	   enum type_code code, LONGEST length, char *name)
2c2fa1
+	   enum type_code code, LONGEST length, const char *name)
2c2fa1
 {
2c2fa1
   struct type *type;
2c2fa1
 
2c2fa1
@@ -4023,6 +4023,18 @@
2c2fa1
   return t;
2c2fa1
 }
2c2fa1
 
2c2fa1
+/* Allocate a TYPE_CODE_DECFLOAT type structure associated with GDBARCH.
2c2fa1
+   BIT is the type size in bits.  NAME is the type name.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+arch_decfloat_type (struct gdbarch *gdbarch, int bit, const char *name)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = arch_type (gdbarch, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
 /* Allocate a TYPE_CODE_COMPLEX type structure associated with GDBARCH.
2c2fa1
    NAME is the type name.  TARGET_TYPE is the component float type.  */
2c2fa1
 
2c2fa1
@@ -4038,6 +4050,23 @@
2c2fa1
   return t;
2c2fa1
 }
2c2fa1
 
2c2fa1
+/* Allocate a TYPE_CODE_PTR type structure associated with GDBARCH.
2c2fa1
+   BIT is the pointer type size in bits.  NAME is the type name.
2c2fa1
+   TARGET_TYPE is the pointer target type.  Always sets the pointer type's
2c2fa1
+   TYPE_UNSIGNED flag.  */
2c2fa1
+
2c2fa1
+struct type *
2c2fa1
+arch_pointer_type (struct gdbarch *gdbarch,
2c2fa1
+		   int bit, const char *name, struct type *target_type)
2c2fa1
+{
2c2fa1
+  struct type *t;
2c2fa1
+
2c2fa1
+  t = arch_type (gdbarch, TYPE_CODE_PTR, bit / TARGET_CHAR_BIT, name);
2c2fa1
+  TYPE_TARGET_TYPE (t) = target_type;
2c2fa1
+  TYPE_UNSIGNED (t) = 1;
2c2fa1
+  return t;
2c2fa1
+}
2c2fa1
+
2c2fa1
 /* Allocate a TYPE_CODE_FLAGS type structure associated with GDBARCH.
2c2fa1
    NAME is the type name.  LENGTH is the size of the flag word in bytes.  */
2c2fa1
 
2c2fa1
@@ -4235,11 +4264,11 @@
2c2fa1
   /* The following three are about decimal floating point types, which
2c2fa1
      are 32-bits, 64-bits and 128-bits respectively.  */
2c2fa1
   builtin_type->builtin_decfloat
2c2fa1
-    = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 32 / 8, "_Decimal32");
2c2fa1
+    = arch_decfloat_type (gdbarch, 32, "_Decimal32");
2c2fa1
   builtin_type->builtin_decdouble
2c2fa1
-    = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 64 / 8, "_Decimal64");
2c2fa1
+    = arch_decfloat_type (gdbarch, 64, "_Decimal64");
2c2fa1
   builtin_type->builtin_declong
2c2fa1
-    = arch_type (gdbarch, TYPE_CODE_DECFLOAT, 128 / 8, "_Decimal128");
2c2fa1
+    = arch_decfloat_type (gdbarch, 128, "_Decimal128");
2c2fa1
 
2c2fa1
   /* "True" character types.  */
2c2fa1
   builtin_type->builtin_true_char
2c2fa1
Index: gdb-7.6.1/gdb/gdbtypes.h
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/gdbtypes.h	2017-03-11 21:27:41.914206796 +0100
2c2fa1
+++ gdb-7.6.1/gdb/gdbtypes.h	2017-03-11 21:29:02.861770587 +0100
2c2fa1
@@ -1547,14 +1547,17 @@
2c2fa1
 
2c2fa1
 /* Helper functions to construct architecture-owned types.  */
2c2fa1
 extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST,
2c2fa1
-			       char *);
2c2fa1
+			       const char *);
2c2fa1
 extern struct type *arch_integer_type (struct gdbarch *, int, int, char *);
2c2fa1
 extern struct type *arch_character_type (struct gdbarch *, int, int, char *);
2c2fa1
 extern struct type *arch_boolean_type (struct gdbarch *, int, int, char *);
2c2fa1
 extern struct type *arch_float_type (struct gdbarch *, int, char *,
2c2fa1
 				     const struct floatformat **);
2c2fa1
+extern struct type *arch_decfloat_type (struct gdbarch *, int, const char *);
2c2fa1
 extern struct type *arch_complex_type (struct gdbarch *, char *,
2c2fa1
 				       struct type *);
2c2fa1
+extern struct type *arch_pointer_type (struct gdbarch *, int, const char *,
2c2fa1
+				       struct type *);
2c2fa1
 
2c2fa1
 /* Helper functions to construct a struct or record type.  An
2c2fa1
    initially empty type is created using arch_composite_type().
2c2fa1
Index: gdb-7.6.1/gdb/m32c-tdep.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.6.1.orig/gdb/m32c-tdep.c	2017-03-11 21:27:41.914206796 +0100
2c2fa1
+++ gdb-7.6.1/gdb/m32c-tdep.c	2017-03-11 21:27:46.930242102 +0100
2c2fa1
@@ -194,27 +194,18 @@
2c2fa1
      this is called, so we avoid using them.  */
2c2fa1
   tdep->voyd = arch_type (arch, TYPE_CODE_VOID, 1, "void");
2c2fa1
   tdep->ptr_voyd
2c2fa1
-    = arch_type (arch, TYPE_CODE_PTR, gdbarch_ptr_bit (arch) / TARGET_CHAR_BIT,
2c2fa1
-                 NULL);
2c2fa1
-  TYPE_TARGET_TYPE (tdep->ptr_voyd) = tdep->voyd;
2c2fa1
-  TYPE_UNSIGNED (tdep->ptr_voyd) = 1;
2c2fa1
+    = arch_pointer_type (arch, gdbarch_ptr_bit (arch), NULL, tdep->voyd);
2c2fa1
   tdep->func_voyd = lookup_function_type (tdep->voyd);
2c2fa1
 
2c2fa1
   xsnprintf (type_name, sizeof (type_name), "%s_data_addr_t",
2c2fa1
 	     gdbarch_bfd_arch_info (arch)->printable_name);
2c2fa1
   tdep->data_addr_reg_type
2c2fa1
-    = arch_type (arch, TYPE_CODE_PTR, data_addr_reg_bits / TARGET_CHAR_BIT,
2c2fa1
-                 xstrdup (type_name));
2c2fa1
-  TYPE_TARGET_TYPE (tdep->data_addr_reg_type) = tdep->voyd;
2c2fa1
-  TYPE_UNSIGNED (tdep->data_addr_reg_type) = 1;
2c2fa1
+    = arch_pointer_type (arch, data_addr_reg_bits, type_name, tdep->voyd);
2c2fa1
 
2c2fa1
   xsnprintf (type_name, sizeof (type_name), "%s_code_addr_t",
2c2fa1
 	     gdbarch_bfd_arch_info (arch)->printable_name);
2c2fa1
   tdep->code_addr_reg_type
2c2fa1
-    = arch_type (arch, TYPE_CODE_PTR, code_addr_reg_bits / TARGET_CHAR_BIT,
2c2fa1
-                 xstrdup (type_name));
2c2fa1
-  TYPE_TARGET_TYPE (tdep->code_addr_reg_type) = tdep->func_voyd;
2c2fa1
-  TYPE_UNSIGNED (tdep->code_addr_reg_type) = 1;
2c2fa1
+    = arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func_voyd);
2c2fa1
 
2c2fa1
   tdep->uint8  = arch_integer_type (arch,  8, 1, "uint8_t");
2c2fa1
   tdep->uint16 = arch_integer_type (arch, 16, 1, "uint16_t");