Automatic date update in version.in
[binutils-gdb.git] / gdbserver / debug.h
index 20cb4e733f266e3681ada54cf0b09f3ad2b509f3..d924275210996e5e9b82ef895e359f4d9dc06e67 100644 (file)
 #define GDBSERVER_DEBUG_H
 
 #if !defined (IN_PROCESS_AGENT)
-extern int remote_debug;
+extern bool remote_debug;
+
+/* Print a "remote" debug statement.  */
+
+#define remote_debug_printf(fmt, ...) \
+  debug_prefixed_printf_cond (remote_debug, \
+                             "remote", fmt, ##__VA_ARGS__)
 
 /* Switch all debug output to DEBUG_FILE.  If DEBUG_FILE is nullptr or an
    empty string, or if the file cannot be opened, then debug output is sent to
@@ -35,31 +41,22 @@ extern int using_threads;
 
 extern bool debug_threads;
 
+/* Print a "threads" debug statement.  */
+
+#define threads_debug_printf(fmt, ...) \
+  debug_prefixed_printf_cond (debug_threads, \
+                             "threads", fmt, ##__VA_ARGS__)
+
+/* Print "threads" enter/exit debug statements.  */
+
+#define THREADS_SCOPED_DEBUG_ENTER_EXIT \
+  scoped_debug_enter_exit (debug_threads, "threads")
+
 extern int debug_timestamp;
 
 void debug_flush (void);
-void do_debug_enter (const char *function_name);
-void do_debug_exit (const char *function_name);
 
 /* Async signal safe debug output function that calls write directly.  */
 ssize_t debug_write (const void *buf, size_t nbyte);
 
-/* These macros are for use in major functions that produce a lot of
-   debugging output.  They help identify in the mass of debugging output
-   when these functions enter and exit.  debug_enter is intended to be
-   called at the start of a function, before any other debugging output.
-   debug_exit is intended to be called at the end of the same function,
-   after all debugging output.  */
-#ifdef FUNCTION_NAME
-#define debug_enter() \
-  do { do_debug_enter (FUNCTION_NAME); } while (0)
-#define debug_exit() \
-  do { do_debug_exit (FUNCTION_NAME); } while (0)
-#else
-#define debug_enter() \
-  do { } while (0)
-#define debug_exit() \
-  do { } while (0)
-#endif
-
 #endif /* GDBSERVER_DEBUG_H */