Remove expecting_notif parameter from getpkt_or_notif_sane_1
[binutils-gdb.git] / gdbserver / linux-low.cc
index 8ab16698632cfd3d56bbbd4c789475637020727d..e1806ade82f076672d6a8d5e37b94b7ace315e71 100644 (file)
@@ -2463,7 +2463,12 @@ linux_process_target::resume_stopped_resumed_lwps (thread_info *thread)
       int step = 0;
 
       if (thread->last_resume_kind == resume_step)
-       step = maybe_hw_step (thread);
+       {
+         if (supports_software_single_step ())
+           install_software_single_step_breakpoints (lp);
+
+         step = maybe_hw_step (thread);
+       }
 
       threads_debug_printf ("resuming stopped-resumed LWP %s at %s: step=%d",
                            target_pid_to_str (ptid_of (thread)).c_str (),
@@ -5377,21 +5382,26 @@ proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf,
     {
       int bytes;
 
-      /* If pread64 is available, use it.  It's faster if the kernel
-        supports it (only one syscall), and it's 64-bit safe even on
-        32-bit platforms (for instance, SPARC debugging a SPARC64
-        application).  */
+      /* Use pread64/pwrite64 if available, since they save a syscall
+        and can handle 64-bit offsets even on 32-bit platforms (for
+        instance, SPARC debugging a SPARC64 application).  But only
+        use them if the offset isn't so high that when cast to off_t
+        it'd be negative, as seen on SPARC64.  pread64/pwrite64
+        outright reject such offsets.  lseek does not.  */
 #ifdef HAVE_PREAD64
-      bytes = (readbuf != nullptr
-              ? pread64 (fd, readbuf, len, memaddr)
-              : pwrite64 (fd, writebuf, len, memaddr));
-#else
-      bytes = -1;
-      if (lseek (fd, memaddr, SEEK_SET) != -1)
+      if ((off_t) memaddr >= 0)
        bytes = (readbuf != nullptr
-                ? read (fd, readbuf, len)
-                : write (fd, writebuf, len));
+                ? pread64 (fd, readbuf, len, memaddr)
+                : pwrite64 (fd, writebuf, len, memaddr));
+      else
 #endif
+       {
+         bytes = -1;
+         if (lseek (fd, memaddr, SEEK_SET) != -1)
+           bytes = (readbuf != nullptr
+                    ? read (fd, readbuf, len)
+                    : write (fd, writebuf, len));
+       }
 
       if (bytes < 0)
        return errno;