+2019-04-17  Alan Hayward  <alan.hayward@arm.com>
+
+       * debug.c (remote_debug): Add definition.
+       * debug.h (remote_debug): Add declaration.
+       * hostio.c (remote_debug): Remove declaration.
+       * remote-utils.c (struct ui_file): Likewise.
+       (remote_debug): Likewise.
+       * remote-utils.h (remote_debug): Likewise,
+       * server.c (remote_debug): Remove definition.
+
 2019-04-10  Kevin Buettner  <kevinb@redhat.com>
 
        * linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
 
 #include "server.h"
 #include <chrono>
 
+#if !defined (IN_PROCESS_AGENT)
+int remote_debug = 0;
+#endif
+
 /* Enable miscellaneous debugging output.  The name is historical - it
    was originally used to debug LinuxThreads support.  */
 int debug_threads;
 
 #ifndef GDBSERVER_DEBUG_H
 #define GDBSERVER_DEBUG_H
 
-/* We declare debug format variables here, and debug_threads but no other
-   debug content variables (e.g., not remote_debug) because while this file
-   is not currently used by IPA it may be some day, and IPA may have its own
-   set of debug content variables.  It's ok to declare debug_threads here
-   because it is misnamed - a better name is debug_basic or some such,
-   which can work for any program, gdbserver or IPA.  If/when this file is
-   used with IPA it is recommended to fix debug_thread's name.  */
+#if !defined (IN_PROCESS_AGENT)
+extern int remote_debug;
+#endif
+
 extern int debug_threads;
 extern int debug_timestamp;
 
 
 #include <sys/stat.h>
 #include "common/fileio.h"
 
-extern int remote_debug;
-
 struct fd_list
 {
   int fd;
 
   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;
 
 #ifndef GDBSERVER_REMOTE_UTILS_H
 #define GDBSERVER_REMOTE_UTILS_H
 
-extern int remote_debug;
-
 int gdb_connected (void);
 
 #define STDIO_CONNECTION_NAME "stdio"
 
   return 0;
 }
 
-extern int remote_debug;
-
 /* Decode a qXfer read request.  Return 0 if everything looks OK,
    or -1 otherwise.  */