diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-01-16 21:21:24 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-01-18 13:44:32 -0500 |
commit | c68665c7260985ac8497ccafcea961f4a261c675 (patch) | |
tree | e191f41840a74d69d137aac3772bef48b04e3367 /gdbserver | |
parent | d66beefaf6334d69b638b3300e264f7996c572dc (diff) | |
download | gdb-c68665c7260985ac8497ccafcea961f4a261c675.zip gdb-c68665c7260985ac8497ccafcea961f4a261c675.tar.gz gdb-c68665c7260985ac8497ccafcea961f4a261c675.tar.bz2 |
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
Diffstat (limited to 'gdbserver')
-rw-r--r-- | gdbserver/ax.cc | 7 | ||||
-rw-r--r-- | gdbserver/debug.cc | 2 | ||||
-rw-r--r-- | gdbserver/debug.h | 2 | ||||
-rw-r--r-- | gdbserver/server.cc | 6 | ||||
-rw-r--r-- | gdbserver/tracepoint.cc | 11 |
5 files changed, 11 insertions, 17 deletions
diff --git a/gdbserver/ax.cc b/gdbserver/ax.cc index d2d0033..4f36bc5 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 202d315..372b557 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 6c5f997..20cb4e7 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 07f119d..021c7ad 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 8ccdf49..0136f6e 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_*. */ |