struct notif_event *head = np->queue.front ();
np->queue.pop_front ();
- if (remote_debug)
- debug_printf ("%s: acking %d\n", np->ack_name,
- (int) np->queue.size ());
+ remote_debug_printf ("%s: acking %d", np->ack_name,
+ (int) np->queue.size ());
delete head;
}
{
notif->queue.push_back (event);
- if (remote_debug)
- debug_printf ("pending events: %s %d\n", notif->notif_name,
- (int) notif->queue.size ());
+ remote_debug_printf ("pending events: %s %d", notif->notif_name,
+ (int) notif->queue.size ());
}
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 ();
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)
{
if (readchar_bufcnt == 0)
{
- if (remote_debug)
- debug_printf ("readchar: Got EOF\n");
+ remote_debug_printf ("readchar: Got EOF");
}
else
perror ("readchar");
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;
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
std::string final_var = hex2str (p);
std::string var_name, var_value;
- if (remote_debug)
- {
- debug_printf (_("[QEnvironmentHexEncoded received '%s']\n"), p);
- debug_printf (_("[Environment variable to be set: '%s']\n"),
- final_var.c_str ());
- debug_flush ();
- }
+ remote_debug_printf ("[QEnvironmentHexEncoded received '%s']", p);
+ remote_debug_printf ("[Environment variable to be set: '%s']",
+ final_var.c_str ());
size_t pos = final_var.find ('=');
if (pos == std::string::npos)
const char *p = own_buf + sizeof ("QEnvironmentUnset:") - 1;
std::string varname = hex2str (p);
- if (remote_debug)
- {
- debug_printf (_("[QEnvironmentUnset received '%s']\n"), p);
- debug_printf (_("[Environment variable to be unset: '%s']\n"),
- varname.c_str ());
- debug_flush ();
- }
+ remote_debug_printf ("[QEnvironmentUnset received '%s']", p);
+ remote_debug_printf ("[Environment variable to be unset: '%s']",
+ varname.c_str ());
our_environ.unset (varname.c_str ());
if (strcmp (own_buf, "QStartNoAckMode") == 0)
{
- if (remote_debug)
- {
- debug_printf ("[noack mode enabled]\n");
- debug_flush ();
- }
+ remote_debug_printf ("[noack mode enabled]");
cs.noack_mode = 1;
write_ok (own_buf);
non_stop = (req != 0);
- if (remote_debug)
- debug_printf ("[%s mode enabled]\n", req_str);
+ remote_debug_printf ("[%s mode enabled]", req_str);
write_ok (own_buf);
return;
unpack_varlen_hex (packet, &setting);
cs.disable_randomization = setting;
- if (remote_debug)
- {
- debug_printf (cs.disable_randomization
- ? "[address space randomization disabled]\n"
- : "[address space randomization enabled]\n");
- }
+ remote_debug_printf (cs.disable_randomization
+ ? "[address space randomization disabled]"
+ : "[address space randomization enabled]");
write_ok (own_buf);
return;
/* Update the flag. */
use_agent = req;
- if (remote_debug)
- debug_printf ("[%s agent]\n", req ? "Enable" : "Disable");
+ remote_debug_printf ("[%s agent]", req ? "Enable" : "Disable");
write_ok (own_buf);
return;
}
cs.report_thread_events = (req == TRIBOOL_TRUE);
- if (remote_debug)
- {
- const char *req_str = cs.report_thread_events ? "enabled" : "disabled";
-
- debug_printf ("[thread events are now %s]\n", req_str);
- }
+ remote_debug_printf ("[thread events are now %s]\n",
+ cs.report_thread_events ? "enabled" : "disabled");
write_ok (own_buf);
return;
return;
}
- if (remote_debug)
- debug_printf (_("[Inferior will %s started with shell]"),
- startup_with_shell ? "be" : "not be");
+ remote_debug_printf ("[Inferior will %s started with shell]",
+ startup_with_shell ? "be" : "not be");
write_ok (own_buf);
return;
{
std::string path = hex2str (p);
- if (remote_debug)
- debug_printf (_("[Set the inferior's current directory to %s]\n"),
- path.c_str ());
+ remote_debug_printf ("[Set the inferior's current directory to %s]",
+ path.c_str ());
set_inferior_cwd (std::move (path));
}
previously set cwd for the inferior. */
set_inferior_cwd ("");
- if (remote_debug)
- debug_printf (_("\
-[Unset the inferior's current directory; will use gdbserver's cwd]\n"));
+ remote_debug_printf ("[Unset the inferior's current directory; will "
+ "use gdbserver's cwd]");
}
write_ok (own_buf);
}
else if (strcmp (mon, "set remote-debug 1") == 0)
{
- remote_debug = 1;
+ remote_debug = true;
monitor_output ("Protocol debug output enabled.\n");
}
else if (strcmp (mon, "set remote-debug 0") == 0)
{
- remote_debug = 0;
+ remote_debug = false;
monitor_output ("Protocol debug output disabled.\n");
}
else if (strcmp (mon, "set event-loop-debug 1") == 0)
}
}
else if (strcmp (*next_arg, "--remote-debug") == 0)
- remote_debug = 1;
+ remote_debug = true;
else if (strcmp (*next_arg, "--event-loop-debug") == 0)
debug_event_loop = debug_event_loop_kind::ALL;
else if (startswith (*next_arg, "--debug-file="))