Multi-target support
[deliverable/binutils-gdb.git] / gdb / gdbserver / remote-utils.c
index 7c495beb7cd9a6f6704c51190b5903a21606f652..b8a8c6576f974b57264d1f6f8c18de79a5b72cb8 100644 (file)
@@ -1,5 +1,5 @@
 /* Remote utility routines for the remote server for GDB.
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "target.h"
 #include "gdbthread.h"
 #include "tdesc.h"
+#include "debug.h"
 #include "dll.h"
-#include "common/rsp-low.h"
-#include "common/netstuff.h"
-#include "common/filestuff.h"
+#include "gdbsupport/rsp-low.h"
+#include "gdbsupport/netstuff.h"
+#include "gdbsupport/filestuff.h"
+#include "gdbsupport/gdb-sigmask.h"
 #include <ctype.h>
 #if HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
@@ -55,7 +57,7 @@
 #if HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#include "common/gdb_sys_time.h"
+#include "gdbsupport/gdb_sys_time.h"
 #include <unistd.h>
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
@@ -109,10 +111,6 @@ static int remote_is_stdio = 0;
 static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR;
 static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR;
 
-/* FIXME headerize? */
-extern int using_threads;
-extern int debug_threads;
-
 #ifdef USE_WIN32API
 # define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
 # define write(fd, buf, len) send (fd, (char *) buf, len, 0)
@@ -810,7 +808,7 @@ block_unblock_async_io (int block)
 
   sigemptyset (&sigio_set);
   sigaddset (&sigio_set, SIGIO);
-  sigprocmask (block ? SIG_BLOCK : SIG_UNBLOCK, &sigio_set, NULL);
+  gdb_sigmask (block ? SIG_BLOCK : SIG_UNBLOCK, &sigio_set, NULL);
 #endif
 }
 
@@ -1210,7 +1208,7 @@ prepare_resume_reply (char *buf, ptid_t ptid,
 
        saved_thread = current_thread;
 
-       switch_to_thread (ptid);
+       switch_to_thread (the_target, ptid);
 
        regp = current_target_desc ()->expedite_regs;
 
@@ -1636,7 +1634,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
        {
          if (decode_X_packet (&cs.own_buf[1], len - 1, &mem_addr,
                               &mem_len, &mem_buf) < 0
-             || write_inferior_memory (mem_addr, mem_buf, mem_len) != 0)
+             || target_write_memory (mem_addr, mem_buf, mem_len) != 0)
            write_enn (cs.own_buf);
          else
            write_ok (cs.own_buf);
@@ -1644,7 +1642,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
       else
        {
          decode_M_packet (&cs.own_buf[1], &mem_addr, &mem_len, &mem_buf);
-         if (write_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
+         if (target_write_memory (mem_addr, mem_buf, mem_len) == 0)
            write_ok (cs.own_buf);
          else
            write_enn (cs.own_buf);
This page took 0.029758 seconds and 4 git commands to generate.