Unify gdb printf functions

Now that filtered and unfiltered output can be treated identically, we
can unify the printf family of functions.  This is done under the name
"gdb_printf".  Most of this patch was written by script.
This commit is contained in:
Tom Tromey 2022-01-02 11:46:15 -07:00
parent a11ac3b3e8
commit 6cb06a8cda
249 changed files with 8449 additions and 8463 deletions

View file

@ -59,7 +59,7 @@ static void
show_debug_threads (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Thread debugging is \"%s\".\n"), value);
gdb_printf (file, _("Thread debugging is \"%s\".\n"), value);
}
/* Definition of struct thread_info exported to gdbthread.h. */
@ -293,7 +293,7 @@ add_thread_with_info (process_stratum_target *targ, ptid_t ptid,
result->priv.reset (priv);
if (print_thread_events)
printf_filtered (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());
gdb_printf (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());
annotate_new_thread ();
return result;
@ -1484,8 +1484,8 @@ thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
if (!flags.silent || cmd_result.length () > 0)
{
if (!flags.quiet)
printf_filtered ("%s", thr_header.c_str ());
printf_filtered ("%s", cmd_result.c_str ());
gdb_printf ("%s", thr_header.c_str ());
gdb_printf ("%s", cmd_result.c_str ());
}
}
catch (const gdb_exception_error &ex)
@ -1493,9 +1493,9 @@ thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
if (!flags.silent)
{
if (!flags.quiet)
printf_filtered ("%s", thr_header.c_str ());
gdb_printf ("%s", thr_header.c_str ());
if (flags.cont)
printf_filtered ("%s\n", ex.what ());
gdb_printf ("%s\n", ex.what ());
else
throw;
}
@ -1811,13 +1811,13 @@ thread_command (const char *tidstr, int from_tty)
struct thread_info *tp = inferior_thread ();
if (tp->state == THREAD_EXITED)
printf_filtered (_("[Current thread is %s (%s) (exited)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
gdb_printf (_("[Current thread is %s (%s) (exited)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
else
printf_filtered (_("[Current thread is %s (%s)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
gdb_printf (_("[Current thread is %s (%s)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
}
else
error (_("No stack."));
@ -1886,37 +1886,37 @@ thread_find_command (const char *arg, int from_tty)
if (tp->name () != nullptr && re_exec (tp->name ()))
{
printf_filtered (_("Thread %s has name '%s'\n"),
print_thread_id (tp), tp->name ());
gdb_printf (_("Thread %s has name '%s'\n"),
print_thread_id (tp), tp->name ());
match++;
}
tmp = target_thread_name (tp);
if (tmp != NULL && re_exec (tmp))
{
printf_filtered (_("Thread %s has target name '%s'\n"),
print_thread_id (tp), tmp);
gdb_printf (_("Thread %s has target name '%s'\n"),
print_thread_id (tp), tmp);
match++;
}
std::string name = target_pid_to_str (tp->ptid);
if (!name.empty () && re_exec (name.c_str ()))
{
printf_filtered (_("Thread %s has target id '%s'\n"),
print_thread_id (tp), name.c_str ());
gdb_printf (_("Thread %s has target id '%s'\n"),
print_thread_id (tp), name.c_str ());
match++;
}
tmp = target_extra_thread_info (tp);
if (tmp != NULL && re_exec (tmp))
{
printf_filtered (_("Thread %s has extra info '%s'\n"),
print_thread_id (tp), tmp);
gdb_printf (_("Thread %s has extra info '%s'\n"),
print_thread_id (tp), tmp);
match++;
}
}
if (!match)
printf_filtered (_("No threads match '%s'\n"), arg);
gdb_printf (_("No threads match '%s'\n"), arg);
}
/* Print notices when new threads are attached and detached. */
@ -1925,9 +1925,9 @@ static void
show_print_thread_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Printing of thread events is %s.\n"),
value);
gdb_printf (file,
_("Printing of thread events is %s.\n"),
value);
}
/* See gdbthread.h. */