Add `set print array-indexes' tests for C/C++ arrays
[binutils-gdb.git] / gdb / mips-linux-nat.c
index b21c7cb2ea68f17e64c194bc53f471fb4fef6f5d..20e12b6889edc2ccafacf587327e0ef787fe3333 100644 (file)
@@ -1,6 +1,6 @@
 /* Native-dependent code for GNU/Linux on MIPS processors.
 
-   Copyright (C) 2001-2021 Free Software Foundation, Inc.
+   Copyright (C) 2001-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -508,25 +508,26 @@ mips_show_dr (const char *func, CORE_ADDR addr,
 {
   int i;
 
-  puts_unfiltered (func);
+  fputs_unfiltered (func, gdb_stdlog);
   if (addr || len)
-    printf_unfiltered (" (addr=%s, len=%d, type=%s)",
-                      paddress (target_gdbarch (), addr), len,
-                      type == hw_write ? "data-write"
-                      : (type == hw_read ? "data-read"
-                         : (type == hw_access ? "data-read/write"
-                            : (type == hw_execute ? "instruction-execute"
-                               : "??unknown??"))));
-  puts_unfiltered (":\n");
+    fprintf_unfiltered (gdb_stdlog,
+                       " (addr=%s, len=%d, type=%s)",
+                       paddress (target_gdbarch (), addr), len,
+                       type == hw_write ? "data-write"
+                       : (type == hw_read ? "data-read"
+                          : (type == hw_access ? "data-read/write"
+                             : (type == hw_execute ? "instruction-execute"
+                                : "??unknown??"))));
+  fputs_unfiltered (":\n", gdb_stdlog);
 
   for (i = 0; i < MAX_DEBUG_REGISTER; i++)
-    printf_unfiltered ("\tDR%d: lo=%s, hi=%s\n", i,
-                      paddress (target_gdbarch (),
-                                mips_linux_watch_get_watchlo (&watch_mirror,
-                                                              i)),
-                      paddress (target_gdbarch (),
-                                mips_linux_watch_get_watchhi (&watch_mirror,
-                                                              i)));
+    fprintf_unfiltered (gdb_stdlog, "\tDR%d: lo=%s, hi=%s\n", i,
+                       paddress (target_gdbarch (),
+                                 mips_linux_watch_get_watchlo (&watch_mirror,
+                                                               i)),
+                       paddress (target_gdbarch (),
+                                 mips_linux_watch_get_watchhi (&watch_mirror,
+                                                               i)));
 }
 
 /* Target to_can_use_hw_breakpoint implementation.  Return 1 if we can
@@ -632,12 +633,9 @@ mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 static int
 write_watchpoint_regs (void)
 {
-  struct lwp_info *lp;
-  int tid;
-
-  ALL_LWPS (lp)
+  for (const lwp_info *lp : all_lwps ())
     {
-      tid = lp->ptid.lwp ();
+      int tid = lp->ptid.lwp ();
       if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
        perror_with_name (_("Couldn't write debug register"));
     }