From: Simon Marchi Date: Mon, 17 Jan 2022 02:21:24 +0000 (-0500) Subject: gdbserver: turn debug_threads into a boolean X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c68665c7260985ac8497ccafcea961f4a261c675;p=binutils-gdb.git gdbserver: turn debug_threads into a boolean debug_threads is always used as a boolean. Except in ax.cc and tracepoint.cc. These files have their own macros that use debug_threads, and have a concept of verbosity level. But they both have a single level, so it's just a boolean in the end. Remove this concept of level. If we ever want to re-introduce it, I think it will be better implemented in a more common location. Change debug_threads to bool and adjust some users that were treating it as an int. Change-Id: I137f596eaf763a08c977dd74417969cedfee9ecf --- diff --git a/gdbserver/ax.cc b/gdbserver/ax.cc index d2d003377e0..4f36bc50cab 100644 --- a/gdbserver/ax.cc +++ b/gdbserver/ax.cc @@ -44,15 +44,12 @@ ax_vdebug (const char *fmt, ...) va_end (ap); } -#define ax_debug_1(level, fmt, args...) \ +#define ax_debug(fmt, args...) \ do { \ - if (level <= debug_threads) \ + if (debug_threads) \ ax_vdebug ((fmt), ##args); \ } while (0) -#define ax_debug(FMT, args...) \ - ax_debug_1 (1, FMT, ##args) - /* This enum must exactly match what is documented in gdb/doc/agentexpr.texi, including all the numerical values. */ diff --git a/gdbserver/debug.cc b/gdbserver/debug.cc index 202d315ab67..372b5577958 100644 --- a/gdbserver/debug.cc +++ b/gdbserver/debug.cc @@ -27,7 +27,7 @@ int remote_debug = 0; static FILE *debug_file = stderr; /* See debug.h. */ -int debug_threads; +bool debug_threads; /* Include timestamps in debugging output. */ int debug_timestamp; diff --git a/gdbserver/debug.h b/gdbserver/debug.h index 6c5f997d09e..20cb4e733f2 100644 --- a/gdbserver/debug.h +++ b/gdbserver/debug.h @@ -33,7 +33,7 @@ extern int using_threads; /* Enable miscellaneous debugging output. The name is historical - it was originally used to debug LinuxThreads support. */ -extern int debug_threads; +extern bool debug_threads; extern int debug_timestamp; diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 07f119dc6a1..021c7adc308 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1380,12 +1380,12 @@ handle_monitor_command (char *mon, char *own_buf) { if (strcmp (mon, "set debug 1") == 0) { - debug_threads = 1; + debug_threads = true; monitor_output ("Debug output enabled.\n"); } else if (strcmp (mon, "set debug 0") == 0) { - debug_threads = 0; + debug_threads = false; monitor_output ("Debug output disabled.\n"); } else if (strcmp (mon, "set debug-hw-points 1") == 0) @@ -3814,7 +3814,7 @@ captured_main (int argc, char *argv[]) *next_arg = NULL; } else if (strcmp (*next_arg, "--debug") == 0) - debug_threads = 1; + debug_threads = true; else if (startswith (*next_arg, "--debug-format=")) { std::string error_msg diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 8ccdf491b99..0136f6e2347 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -77,17 +77,17 @@ trace_vdebug (const char *fmt, ...) va_end (ap); } -#define trace_debug_1(level, fmt, args...) \ +#define trace_debug(fmt, args...) \ do { \ - if (level <= debug_threads) \ + if (debug_threads) \ trace_vdebug ((fmt), ##args); \ } while (0) #else -#define trace_debug_1(level, fmt, args...) \ +#define trace_debug(fmt, args...) \ do { \ - if (level <= debug_threads) \ + if (debug_threads) \ { \ debug_printf ((fmt), ##args); \ debug_printf ("\n"); \ @@ -96,9 +96,6 @@ trace_vdebug (const char *fmt, ...) #endif -#define trace_debug(FMT, args...) \ - trace_debug_1 (1, FMT, ##args) - /* Prefix exported symbols, for good citizenship. All the symbols that need exporting are defined in this module. Note that all these symbols must be tagged with IP_AGENT_EXPORT_*. */