Multi-target support
[deliverable/binutils-gdb.git] / gdb / gdbserver / remote-utils.c
index e7a2170bbd2098bad2772f3cf4f80cfbf60cd331..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 "rsp-low.h"
-#include "netstuff.h"
-#include "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 "gdb_sys_time.h"
+#include "gdbsupport/gdb_sys_time.h"
 #include <unistd.h>
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
@@ -63,8 +65,7 @@
 #include <sys/stat.h>
 
 #if USE_WIN32API
-#include <winsock2.h>
-#include <wspiapi.h>
+#include <ws2tcpip.h>
 #endif
 
 #if __QNX__
@@ -105,18 +106,11 @@ struct sym_cache
   struct sym_cache *next;
 };
 
-int remote_debug = 0;
-struct ui_file *gdb_stdlog;
-
 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)
@@ -814,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
 }
 
@@ -1214,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;
 
@@ -1562,7 +1556,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
 
   if (!startswith (cs.own_buf, "qSymbol:"))
     {
-      warning ("Malformed response to qSymbol, ignoring: %s\n", cs.own_buf);
+      warning ("Malformed response to qSymbol, ignoring: %s", cs.own_buf);
       return -1;
     }
 
@@ -1640,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);
@@ -1648,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);
@@ -1663,14 +1657,14 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
 
   if (cs.own_buf[0] == 'E')
     {
-      warning ("An error occurred while relocating an instruction: %s\n",
+      warning ("An error occurred while relocating an instruction: %s",
               cs.own_buf);
       return -1;
     }
 
   if (!startswith (cs.own_buf, "qRelocInsn:"))
     {
-      warning ("Malformed response to qRelocInsn, ignoring: %s\n",
+      warning ("Malformed response to qRelocInsn, ignoring: %s",
               cs.own_buf);
       return -1;
     }
This page took 0.028078 seconds and 4 git commands to generate.