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

@@ -2775,10 +2775,10 @@ show_task_pause_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
check_empty (args, "show task pause");
printf_filtered ("The inferior task %s suspended while gdb has control.\n",
inf->task
? (inf->pause_sc == 0 ? "isn't" : "is")
: (inf->pause_sc == 0 ? "won't be" : "will be"));
gdb_printf ("The inferior task %s suspended while gdb has control.\n",
inf->task
? (inf->pause_sc == 0 ? "isn't" : "is")
: (inf->pause_sc == 0 ? "won't be" : "will be"));
}
static void
@@ -2792,9 +2792,9 @@ static void
show_task_detach_sc_cmd (const char *args, int from_tty)
{
check_empty (args, "show task detach-suspend-count");
printf_filtered ("The inferior task will be left with a "
"suspend count of %d when detaching.\n",
cur_inf ()->detach_sc);
gdb_printf ("The inferior task will be left with a "
"suspend count of %d when detaching.\n",
cur_inf ()->detach_sc);
}
@@ -2814,9 +2814,9 @@ show_thread_default_pause_cmd (const char *args, int from_tty)
int sc = inf->default_thread_pause_sc;
check_empty (args, "show thread default pause");
printf_filtered ("New threads %s suspended while gdb has control%s.\n",
sc ? "are" : "aren't",
!sc && inf->pause_sc ? " (but the task is)" : "");
gdb_printf ("New threads %s suspended while gdb has control%s.\n",
sc ? "are" : "aren't",
!sc && inf->pause_sc ? " (but the task is)" : "");
}
static void
@@ -2834,8 +2834,8 @@ show_thread_default_run_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
check_empty (args, "show thread default run");
printf_filtered ("New threads %s allowed to run.\n",
inf->default_thread_run_sc == 0 ? "are" : "aren't");
gdb_printf ("New threads %s allowed to run.\n",
inf->default_thread_run_sc == 0 ? "are" : "aren't");
}
static void
@@ -2849,8 +2849,8 @@ static void
show_thread_default_detach_sc_cmd (const char *args, int from_tty)
{
check_empty (args, "show thread default detach-suspend-count");
printf_filtered ("New threads will get a detach-suspend-count of %d.\n",
cur_inf ()->default_thread_detach_sc);
gdb_printf ("New threads will get a detach-suspend-count of %d.\n",
cur_inf ()->default_thread_detach_sc);
}
@@ -2913,8 +2913,8 @@ show_stopped_cmd (const char *args, int from_tty)
struct inf *inf = active_inf ();
check_empty (args, "show stopped");
printf_filtered ("The inferior process %s stopped.\n",
inf->stopped ? "is" : "isn't");
gdb_printf ("The inferior process %s stopped.\n",
inf->stopped ? "is" : "isn't");
}
static void
@@ -2942,10 +2942,10 @@ show_sig_thread_cmd (const char *args, int from_tty)
check_empty (args, "show signal-thread");
if (inf->signal_thread)
printf_filtered ("The signal thread is %s.\n",
proc_string (inf->signal_thread));
gdb_printf ("The signal thread is %s.\n",
proc_string (inf->signal_thread));
else
printf_filtered ("There is no signal thread.\n");
gdb_printf ("There is no signal thread.\n");
}
@@ -2973,10 +2973,10 @@ show_signals_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
check_empty (args, "show signals");
printf_filtered ("The inferior process's signals %s intercepted.\n",
inf->task
? (inf->traced ? "are" : "aren't")
: (inf->want_signals ? "will be" : "won't be"));
gdb_printf ("The inferior process's signals %s intercepted.\n",
inf->task
? (inf->traced ? "are" : "aren't")
: (inf->want_signals ? "will be" : "won't be"));
}
static void
@@ -3002,18 +3002,18 @@ show_exceptions_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
check_empty (args, "show exceptions");
printf_filtered ("Exceptions in the inferior %s trapped.\n",
inf->task
? (inf->want_exceptions ? "are" : "aren't")
: (inf->want_exceptions ? "will be" : "won't be"));
gdb_printf ("Exceptions in the inferior %s trapped.\n",
inf->task
? (inf->want_exceptions ? "are" : "aren't")
: (inf->want_exceptions ? "will be" : "won't be"));
}
static void
set_task_cmd (const char *args, int from_tty)
{
printf_filtered ("\"set task\" must be followed by the name"
" of a task property.\n");
gdb_printf ("\"set task\" must be followed by the name"
" of a task property.\n");
}
static void
@@ -3277,10 +3277,10 @@ show_thread_pause_cmd (const char *args, int from_tty)
int sc = thread->pause_sc;
check_empty (args, "show task pause");
printf_filtered ("Thread %s %s suspended while gdb has control%s.\n",
proc_string (thread),
sc ? "is" : "isn't",
!sc && thread->inf->pause_sc ? " (but the task is)" : "");
gdb_printf ("Thread %s %s suspended while gdb has control%s.\n",
proc_string (thread),
sc ? "is" : "isn't",
!sc && thread->inf->pause_sc ? " (but the task is)" : "");
}
static void
@@ -3297,9 +3297,9 @@ show_thread_run_cmd (const char *args, int from_tty)
struct proc *thread = cur_thread ();
check_empty (args, "show thread run");
printf_filtered ("Thread %s %s allowed to run.",
proc_string (thread),
thread->run_sc == 0 ? "is" : "isn't");
gdb_printf ("Thread %s %s allowed to run.",
proc_string (thread),
thread->run_sc == 0 ? "is" : "isn't");
}
static void
@@ -3315,10 +3315,10 @@ show_thread_detach_sc_cmd (const char *args, int from_tty)
struct proc *thread = cur_thread ();
check_empty (args, "show thread detach-suspend-count");
printf_filtered ("Thread %s will be left with a suspend count"
" of %d when detaching.\n",
proc_string (thread),
thread->detach_sc);
gdb_printf ("Thread %s will be left with a suspend count"
" of %d when detaching.\n",
proc_string (thread),
thread->detach_sc);
}
static void
@@ -3360,7 +3360,7 @@ thread_takeover_sc_cmd (const char *args, int from_tty)
error (("%s."), safe_strerror (err));
thread->sc = info->suspend_count;
if (from_tty)
printf_filtered ("Suspend count was %d.\n", thread->sc);
gdb_printf ("Suspend count was %d.\n", thread->sc);
if (info != &_info)
vm_deallocate (mach_task_self (), (vm_address_t) info,
info_len * sizeof (int));