aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/remote-utils.cc
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-01-16 21:16:02 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2022-01-18 13:44:38 -0500
commit91f94053dd72ea88a4d282f94836bc4c0d6c0785 (patch)
treee2dbe3514f069073026ff19152446e6763296d55 /gdbserver/remote-utils.cc
parentc058728c31684d08da396f1bf50fabaa196dc9d9 (diff)
downloadfsf-binutils-gdb-91f94053dd72ea88a4d282f94836bc4c0d6c0785.zip
fsf-binutils-gdb-91f94053dd72ea88a4d282f94836bc4c0d6c0785.tar.gz
fsf-binutils-gdb-91f94053dd72ea88a4d282f94836bc4c0d6c0785.tar.bz2
gdbserver: introduce remote_debug_printf
Add remote_debug_printf, and use it for all debug messages controlled by remote_debug. Change remote_debug to be a bool, which is trivial in this case. Change-Id: I90de13cb892faec3830047b571661822b126d6e8
Diffstat (limited to 'gdbserver/remote-utils.cc')
-rw-r--r--gdbserver/remote-utils.cc55
1 files changed, 13 insertions, 42 deletions
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 8cd8f52..3004130 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -670,22 +670,15 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
if (cs.noack_mode || is_notif)
{
/* Don't expect an ack then. */
- if (remote_debug)
- {
- if (is_notif)
- debug_printf ("putpkt (\"%s\"); [notif]\n", buf2);
- else
- debug_printf ("putpkt (\"%s\"); [noack mode]\n", buf2);
- debug_flush ();
- }
+ if (is_notif)
+ remote_debug_printf ("putpkt (\"%s\"); [notif]", buf2);
+ else
+ remote_debug_printf ("putpkt (\"%s\"); [noack mode]", buf2);
+
break;
}
- if (remote_debug)
- {
- debug_printf ("putpkt (\"%s\"); [looking for ack]\n", buf2);
- debug_flush ();
- }
+ remote_debug_printf ("putpkt (\"%s\"); [looking for ack]", buf2);
cc = readchar ();
@@ -695,11 +688,7 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
return -1;
}
- if (remote_debug)
- {
- debug_printf ("[received '%c' (0x%x)]\n", cc, cc);
- debug_flush ();
- }
+ remote_debug_printf ("[received '%c' (0x%x)]", cc, cc);
/* Check for an input interrupt while we're here. */
if (cc == '\003' && current_thread != NULL)
@@ -868,8 +857,7 @@ readchar (void)
{
if (readchar_bufcnt == 0)
{
- if (remote_debug)
- debug_printf ("readchar: Got EOF\n");
+ remote_debug_printf ("readchar: Got EOF");
}
else
perror ("readchar");
@@ -950,11 +938,8 @@ getpkt (char *buf)
if (c == '$')
break;
- if (remote_debug)
- {
- debug_printf ("[getpkt: discarding char '%c']\n", c);
- debug_flush ();
- }
+
+ remote_debug_printf ("[getpkt: discarding char '%c']", c);
if (c < 0)
return -1;
@@ -997,29 +982,15 @@ getpkt (char *buf)
if (!cs.noack_mode)
{
- if (remote_debug)
- {
- debug_printf ("getpkt (\"%s\"); [sending ack] \n", buf);
- debug_flush ();
- }
+ remote_debug_printf ("getpkt (\"%s\"); [sending ack]", buf);
if (write_prim ("+", 1) != 1)
return -1;
- if (remote_debug)
- {
- debug_printf ("[sent ack]\n");
- debug_flush ();
- }
+ remote_debug_printf ("[sent ack]");
}
else
- {
- if (remote_debug)
- {
- debug_printf ("getpkt (\"%s\"); [no ack sent] \n", buf);
- debug_flush ();
- }
- }
+ remote_debug_printf ("getpkt (\"%s\"); [no ack sent]", buf);
/* The readchar above may have already read a '\003' out of the socket
and moved it to the local buffer. For example, when GDB sends