gdbserver: Move remote_debug to a single place
authorAlan Hayward <alan.hayward@arm.com>
Fri, 12 Apr 2019 13:21:55 +0000 (14:21 +0100)
committerAlan Hayward <alan.hayward@arm.com>
Wed, 17 Apr 2019 08:54:47 +0000 (09:54 +0100)
A comment in debug.h (written in 2014) states: "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".

This has resulted in remote_debug being declared in many .c/.h files
throughout gdbserver.

It would be much simplier to define it one place.  The most logical place to
define it is in debug.h, surrounded by #define guards.  If IPA is changed,
then at that point the variable can be moved elsewhere.

gdb/gdbserver/ChangeLog:

* 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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/debug.c
gdb/gdbserver/debug.h
gdb/gdbserver/hostio.c
gdb/gdbserver/remote-utils.c
gdb/gdbserver/remote-utils.h
gdb/gdbserver/server.c

index 2a5233b663370fb3daa569d62da57af6edf05096..0581f59b5df72ec001010a0905aa4b0f5eec3d49 100644 (file)
@@ -1,3 +1,13 @@
+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
index a5b791b6dfbc9a392523e81660a108044abfbd28..7c4c77afe245f3b269f0db71b848c857bce3b694 100644 (file)
 #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;
index e40f28c77168dff376597523f4f943f98ce60051..c8d5e3365e749cc4360e4fc37bf51e3acc74e7b0 100644 (file)
 #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;
 
index cf75de0c00440ebe1814e6eef628f463451c8dc0..eedf6d9fe7212b5fa266c11553370313a710fa6d 100644 (file)
@@ -29,8 +29,6 @@
 #include <sys/stat.h>
 #include "common/fileio.h"
 
-extern int remote_debug;
-
 struct fd_list
 {
   int fd;
index 4e6f9c62de8bb52db4d771f69cc780fb9112baeb..903d77349d38f0d2f7b8f6e5a530a3990b1ad251 100644 (file)
@@ -108,9 +108,6 @@ 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;
index 587afdb0283b371e19100ee05df9a47dddfa51f1..4ca5d9435e57330b0d8b22714b90a7b2b6b01d03 100644 (file)
@@ -19,8 +19,6 @@
 #ifndef GDBSERVER_REMOTE_UTILS_H
 #define GDBSERVER_REMOTE_UTILS_H
 
-extern int remote_debug;
-
 int gdb_connected (void);
 
 #define STDIO_CONNECTION_NAME "stdio"
index f2c8f15169e18ede5e01a7f39155432544065454..3f6c849dbcb67ae58fdf9d066af4e97bf27ef940 100644 (file)
@@ -328,8 +328,6 @@ attach_inferior (int pid)
   return 0;
 }
 
-extern int remote_debug;
-
 /* Decode a qXfer read request.  Return 0 if everything looks OK,
    or -1 otherwise.  */
 
This page took 0.035172 seconds and 4 git commands to generate.