public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver: turn debug_threads into a boolean
@ 2022-01-18 18:45 Simon Marchi
0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-01-18 18:45 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c68665c7260985ac8497ccafcea961f4a261c675
commit c68665c7260985ac8497ccafcea961f4a261c675
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date: Sun Jan 16 21:21:24 2022 -0500
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:
---
gdbserver/ax.cc | 7 ++-----
gdbserver/debug.cc | 2 +-
gdbserver/debug.h | 2 +-
gdbserver/server.cc | 6 +++---
gdbserver/tracepoint.cc | 11 ++++-------
5 files changed, 11 insertions(+), 17 deletions(-)
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_*. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-18 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 18:45 [binutils-gdb] gdbserver: turn debug_threads into a boolean Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).