bfd/binutils: support for gdb target descriptions in the core file
[binutils-gdb.git] / gdb / ada-valprint.c
index 6ddb584d11c18f2bc5ac3929eabd22719563384c..0d5b6d73076b154131c59428857a73b34ed29b1d 100644 (file)
@@ -1,6 +1,6 @@
 /* Support for printing Ada values for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -136,7 +136,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
   {
     LONGEST high;
 
-    if (get_discrete_bounds (index_type, &low, &high) < 0)
+    if (!get_discrete_bounds (index_type, &low, &high))
       len = 1;
     else if (low > high)
       {
@@ -741,22 +741,10 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
   struct type *type = ada_check_typedef (value_type (val));
   const gdb_byte *valaddr = value_contents_for_printing (val);
 
-  if (ada_is_gnat_encoded_fixed_point_type (type))
-    {
-      struct value *scale = gnat_encoded_fixed_point_scaling_factor (type);
-      val = value_cast (value_type (scale), val);
-      val = value_binop (val, scale, BINOP_MUL);
-
-      const char *fmt = TYPE_LENGTH (type) < 4 ? "%.11g" : "%.17g";
-      std::string str
-       = target_float_to_string (value_contents (val), value_type (val), fmt);
-      fputs_filtered (str.c_str (), stream);
-      return;
-    }
-  else if (type->code () == TYPE_CODE_RANGE
-          && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM
-              || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL
-              || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR))
+  if (type->code () == TYPE_CODE_RANGE
+      && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM
+         || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL
+         || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR))
     {
       /* For enum-valued ranges, we want to recurse, because we'll end
         up printing the constant's name rather than its numeric
@@ -788,7 +776,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
             so we have to work-around this deficiency by handling
             System.Address values as a special case.  */
 
-         struct gdbarch *gdbarch = get_type_arch (type);
+         struct gdbarch *gdbarch = type->arch ();
          struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
          CORE_ADDR addr = extract_typed_address (valaddr, ptr_type);