tic4x: sign extension using shifts
[deliverable/binutils-gdb.git] / gdb / linux-record.c
index bf2041996e119eef3cbf2df8da82e07279e863a1..7e1897d5d6e3011808f5b6009145e9cd397adbde 100644 (file)
@@ -1,6 +1,6 @@
 /* Process record and replay target code for GNU/Linux.
 
-   Copyright (C) 2008-2016 Free Software Foundation, Inc.
+   Copyright (C) 2008-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,6 +24,7 @@
 #include "record.h"
 #include "record-full.h"
 #include "linux-record.h"
+#include "gdbarch.h"
 
 /* These macros are the values of the first argument of system call
    "sys_ptrace".  The values of these macros were obtained from Linux
@@ -83,7 +84,7 @@
 #define RECORD_Q_XGETQUOTA     (('3' << 8) + 3)
 
 #define OUTPUT_REG(val, num)      phex_nz ((val), \
-    TYPE_LENGTH (gdbarch_register_type (get_regcache_arch (regcache), (num))))
+    TYPE_LENGTH (gdbarch_register_type (regcache->arch (), (num))))
 
 /* Record a memory area of length LEN pointed to by register
    REGNUM.  */
@@ -104,7 +105,7 @@ record_linux_sockaddr (struct regcache *regcache,
 {
   gdb_byte *a;
   int addrlen;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   if (!addr)
@@ -141,7 +142,7 @@ record_linux_msghdr (struct regcache *regcache,
                     struct linux_record_tdep *tdep, ULONGEST addr)
 {
   gdb_byte *a;
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR tmpaddr;
   int tmpint;
@@ -242,7 +243,7 @@ record_linux_system_call (enum gdb_syscall syscall,
                          struct regcache *regcache,
                          struct linux_record_tdep *tdep)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   ULONGEST tmpulongest;
   CORE_ADDR tmpaddr;
@@ -254,23 +255,18 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_exit:
-      {
-       int q;
-
-       target_terminal_ours ();
-       q = yquery (_("The next instruction is syscall exit.  "
-                     "It will make the program exit.  "
-                     "Do you want to stop the program?"));
-       target_terminal_inferior ();
-       if (q)
-         return 1;
-      }
+      if (yquery (_("The next instruction is syscall exit.  "
+                   "It will make the program exit.  "
+                   "Do you want to stop the program?")))
+       return 1;
       break;
 
     case gdb_sys_fork:
       break;
 
     case gdb_sys_read:
+    case gdb_sys_readlink:
+    case gdb_sys_recv:
       regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
       if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
        return -1;
@@ -355,6 +351,7 @@ record_linux_system_call (enum gdb_syscall syscall,
       break;
 
     case gdb_sys_pipe:
+    case gdb_sys_pipe2:
       if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
        return -1;
       break;
@@ -652,28 +649,15 @@ record_linux_system_call (enum gdb_syscall syscall,
     case gdb_sys_symlink:
       break;
 
-    case gdb_sys_readlink:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
-       return -1;
-      break;
-
     case gdb_sys_uselib:
     case gdb_sys_swapon:
       break;
 
     case gdb_sys_reboot:
-      {
-       int q;
-
-       target_terminal_ours ();
-       q = yquery (_("The next instruction is syscall reboot.  "
-                     "It will restart the computer.  "
-                     "Do you want to stop the program?"));
-       target_terminal_inferior ();
-       if (q)
-         return 1;
-      }
+      if (yquery (_("The next instruction is syscall reboot.  "
+                   "It will restart the computer.  "
+                   "Do you want to stop the program?")))
+       return 1;
       break;
 
     case gdb_old_readdir:
@@ -693,17 +677,12 @@ record_linux_system_call (enum gdb_syscall syscall,
        regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
        if (record_full_memory_query)
          {
-           int q;
-
-           target_terminal_ours ();
-           q = yquery (_("\
+           if (yquery (_("\
 The next instruction is syscall munmap.\n\
 It will free the memory addr = 0x%s len = %u.\n\
 It will make record target cannot record some memory change.\n\
 Do you want to stop the program?"),
-                       OUTPUT_REG (tmpulongest, tdep->arg1), (int) len);
-           target_terminal_inferior ();
-           if (q)
+                       OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
              return 1;
          }
       }
@@ -761,12 +740,6 @@ Do you want to stop the program?"),
       }
       break;
 
-    case gdb_sys_recv:
-      regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
-      if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
-       return -1;
-      break;
-
     case gdb_sys_recvmsg:
       regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
       if (record_linux_msghdr (regcache, tdep, tmpulongest))
@@ -909,6 +882,7 @@ Do you want to stop the program?"),
              if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
                return -1;
            }
+         break;
        case RECORD_SYS_RECV:
          regcache_raw_read_unsigned (regcache, tdep->arg2,
                                      &tmpulongest);
@@ -1764,17 +1738,10 @@ Do you want to stop the program?"),
       break;
 
     case gdb_sys_exit_group:
-      {
-       int q;
-
-       target_terminal_ours ();
-       q = yquery (_("The next instruction is syscall exit_group.  "
-                     "It will make the program exit.  "
-                     "Do you want to stop the program?"));
-       target_terminal_inferior ();
-       if (q)
-         return 1;
-      }
+      if (yquery (_("The next instruction is syscall exit_group.  "
+                   "It will make the program exit.  "
+                   "Do you want to stop the program?")))
+       return 1;
       break;
 
     case gdb_sys_lookup_dcookie:
@@ -2061,11 +2028,6 @@ Do you want to stop the program?"),
     case gdb_sys_dup3:
       break;
 
-    case gdb_sys_pipe2:
-      if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
-       return -1;
-      break;
-
     case gdb_sys_inotify_init1:
       break;
 
This page took 0.026937 seconds and 4 git commands to generate.