Adjust byte order variable display/change if DW_AT_endianity is present.
[deliverable/binutils-gdb.git] / gdb / gdbtypes.c
index fd1c765fed02095bb6396779f310bb68633fd0d9..31c1a7b732b1627077a3b1dcd566875b4e8b1829 100644 (file)
@@ -3616,6 +3616,7 @@ check_types_equal (struct type *type1, struct type *type2,
       || TYPE_LENGTH (type1) != TYPE_LENGTH (type2)
       || TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2)
       || TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2)
+      || TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2)
       || TYPE_VARARGS (type1) != TYPE_VARARGS (type2)
       || TYPE_VECTOR (type1) != TYPE_VECTOR (type2)
       || TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
@@ -4669,6 +4670,10 @@ recursive_dump_type (struct type *type, int spaces)
     {
       puts_filtered (" TYPE_NOSIGN");
     }
+  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
+    {
+      puts_filtered (" TYPE_ENDIANITY_NOT_DEFAULT");
+    }
   if (TYPE_STUB (type))
     {
       puts_filtered (" TYPE_STUB");
@@ -5617,3 +5622,21 @@ _initialize_gdbtypes (void)
                           show_strict_type_checking,
                           &setchecklist, &showchecklist);
 }
+
+/* See gdbtypes.h.  */
+enum bfd_endian
+type_byte_order (const struct type *type)
+{
+  bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
+  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
+    {
+      if (byteorder == BFD_ENDIAN_BIG)
+        return BFD_ENDIAN_LITTLE;
+      else if (byteorder == BFD_ENDIAN_LITTLE)
+        return BFD_ENDIAN_BIG;
+      else
+        return BFD_ENDIAN_UNKNOWN;
+    }
+
+  return byteorder;
+}
This page took 0.032012 seconds and 4 git commands to generate.