Add `set print array-indexes' tests for C/C++ arrays
[binutils-gdb.git] / gdb / printcmd.c
index 416b87c69c6f575a7f1a8398e22db2a7c305772f..509f62c21c76f671763ad2d7d325d58b6a349b3d 100644 (file)
@@ -1,6 +1,6 @@
 /* Print values for GNU debugger GDB.
 
-   Copyright (C) 1986-2021 Free Software Foundation, Inc.
+   Copyright (C) 1986-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -1683,8 +1683,7 @@ info_address_command (const char *exp, int from_tty)
     }
 
   printf_filtered ("Symbol \"");
-  fprintf_symbol_filtered (gdb_stdout, sym->print_name (),
-                          current_language->la_language, DMGL_ANSI);
+  fputs_filtered (sym->print_name (), gdb_stdout);
   printf_filtered ("\" is ");
   val = SYMBOL_VALUE (sym);
   if (SYMBOL_OBJFILE_OWNED (sym))
@@ -1725,7 +1724,7 @@ info_address_command (const char *exp, int from_tty)
       break;
 
     case LOC_COMPUTED:
-      gdb_assert_not_reached (_("LOC_COMPUTED variable missing a method"));
+      gdb_assert_not_reached ("LOC_COMPUTED variable missing a method");
 
     case LOC_REGISTER:
       /* GDBARCH is the architecture associated with the objfile the symbol
@@ -2059,7 +2058,7 @@ map_display_numbers (const char *args,
                                      return item->number == num;
                                    });
          if (iter == all_displays.end ())
-           printf_unfiltered (_("No display number %d.\n"), num);
+           printf_filtered (_("No display number %d.\n"), num);
          else
            function (iter->get ());
        }
@@ -2254,7 +2253,7 @@ disable_display (int num)
        d->enabled_p = false;
        return;
       }
-  printf_unfiltered (_("No display number %d.\n"), num);
+  printf_filtered (_("No display number %d.\n"), num);
 }
 
 void
@@ -2275,7 +2274,7 @@ static void
 info_display_command (const char *ignore, int from_tty)
 {
   if (all_displays.empty ())
-    printf_unfiltered (_("There are no auto-display expressions now.\n"));
+    printf_filtered (_("There are no auto-display expressions now.\n"));
   else
     printf_filtered (_("Auto-display expressions now in effect:\n\
 Num Enb Expression\n"));
@@ -2448,7 +2447,7 @@ printf_c_string (struct ui_file *stream, const char *format,
         null terminated) to be printed without problems.  */
       gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
 
-      memcpy (tem_str, value_contents (value), len);
+      memcpy (tem_str, value_contents (value).data (), len);
       tem_str [len] = 0;
       str = tem_str;
     }
@@ -2512,7 +2511,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
   if (VALUE_LVAL (value) == lval_internalvar
       && c_is_string_type_p (value_type (value)))
     {
-      str = value_contents (value);
+      str = value_contents (value).data ();
       len = TYPE_LENGTH (value_type (value));
     }
   else
@@ -2621,14 +2620,15 @@ printf_floating (struct ui_file *stream, const char *format,
     {
       param_type = float_type_from_length (param_type);
       if (param_type != value_type (value))
-       value = value_from_contents (param_type, value_contents (value));
+       value = value_from_contents (param_type,
+                                    value_contents (value).data ());
     }
 
   value = value_cast (fmt_type, value);
 
   /* Convert the value to a string and print it.  */
   std::string str
-    = target_float_to_string (value_contents (value), fmt_type, format);
+    = target_float_to_string (value_contents (value).data (), fmt_type, format);
   fputs_filtered (str.c_str (), stream);
 }
 
@@ -2789,7 +2789,7 @@ ui_printf (const char *arg, struct ui_file *stream)
                  || valtype->code () != TYPE_CODE_INT)
                error (_("expected wchar_t argument for %%lc"));
 
-             bytes = value_contents (val_args[i]);
+             bytes = value_contents (val_args[i]).data ();
 
              auto_obstack output;