aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/remote-utils.cc
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-01-16 21:27:58 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-01-18 13:44:32 -0500
commitc058728c31684d08da396f1bf50fabaa196dc9d9 (patch)
tree8e0d08d18cf135f7071fa9ee37dd549ee86656a8 /gdbserver/remote-utils.cc
parentc68665c7260985ac8497ccafcea961f4a261c675 (diff)
downloadfsf-binutils-gdb-c058728c31684d08da396f1bf50fabaa196dc9d9.zip
fsf-binutils-gdb-c058728c31684d08da396f1bf50fabaa196dc9d9.tar.gz
fsf-binutils-gdb-c058728c31684d08da396f1bf50fabaa196dc9d9.tar.bz2
gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXIT
Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which use the logging infrastructure from gdbsupport/common-debug.h. Replace all debug_print uses that are predicated by debug_threads with threads_dethreads_debug_printf. Replace uses of the debug_enter and debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves essentially the same purpose, but allows showing what comes between the enter and the exit in an indented form. Note that "threads" debug is currently used for a bit of everything in GDBserver, not only threads related stuff. It should ideally be cleaned up and separated logically as is done in GDB, but that's out of the scope of this patch. Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
Diffstat (limited to 'gdbserver/remote-utils.cc')
-rw-r--r--gdbserver/remote-utils.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 0faf5a9..8cd8f52 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -144,8 +144,7 @@ handle_accept_event (int err, gdb_client_data client_data)
struct sockaddr_storage sockaddr;
socklen_t len = sizeof (sockaddr);
- if (debug_threads)
- debug_printf ("handling possible accept event\n");
+ threads_debug_printf ("handling possible accept event");
remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len);
if (remote_desc == -1)
@@ -1084,9 +1083,8 @@ void
prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
{
client_state &cs = get_client_state ();
- if (debug_threads)
- debug_printf ("Writing resume reply for %s:%d\n",
- target_pid_to_str (ptid).c_str (), status.kind ());
+ threads_debug_printf ("Writing resume reply for %s:%d",
+ target_pid_to_str (ptid).c_str (), status.kind ());
switch (status.kind ())
{