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
This commit is contained in:
Simon Marchi 2022-01-16 21:21:24 -05:00
parent d66beefaf6
commit c68665c726
5 changed files with 11 additions and 17 deletions

View File

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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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_*. */