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

@ -348,8 +348,8 @@ linux_fork_mourn_inferior (void)
last = find_last_fork ();
fork_load_infrun_state (last);
printf_filtered (_("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
gdb_printf (_("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
if (one_fork_p ())
@ -381,8 +381,8 @@ linux_fork_detach (int from_tty)
fork_load_infrun_state (&fork_list.front ());
if (from_tty)
printf_filtered (_("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
gdb_printf (_("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
if (one_fork_p ())
@ -509,7 +509,7 @@ Please switch to another checkpoint before deleting the current one"));
pptid = fi->parent_ptid;
if (from_tty)
printf_filtered (_("Killed %s\n"), target_pid_to_str (ptid).c_str ());
gdb_printf (_("Killed %s\n"), target_pid_to_str (ptid).c_str ());
delete_fork (ptid);
@ -547,7 +547,7 @@ Please switch to another checkpoint before detaching the current one"));
error (_("Unable to detach %s"), target_pid_to_str (ptid).c_str ());
if (from_tty)
printf_filtered (_("Detached %s\n"), target_pid_to_str (ptid).c_str ());
gdb_printf (_("Detached %s\n"), target_pid_to_str (ptid).c_str ());
delete_fork (ptid);
}
@ -571,30 +571,30 @@ info_checkpoints_command (const char *arg, int from_tty)
printed = &fi;
if (fi.ptid == inferior_ptid)
printf_filtered ("* ");
gdb_printf ("* ");
else
printf_filtered (" ");
gdb_printf (" ");
ULONGEST pc = fi.pc;
printf_filtered ("%d %s", fi.num, target_pid_to_str (fi.ptid).c_str ());
gdb_printf ("%d %s", fi.num, target_pid_to_str (fi.ptid).c_str ());
if (fi.num == 0)
printf_filtered (_(" (main process)"));
printf_filtered (_(" at "));
gdb_printf (_(" (main process)"));
gdb_printf (_(" at "));
gdb_puts (paddress (gdbarch, pc));
symtab_and_line sal = find_pc_line (pc, 0);
if (sal.symtab)
printf_filtered (_(", file %s"),
symtab_to_filename_for_display (sal.symtab));
gdb_printf (_(", file %s"),
symtab_to_filename_for_display (sal.symtab));
if (sal.line)
printf_filtered (_(", line %d"), sal.line);
gdb_printf (_(", line %d"), sal.line);
if (!sal.symtab && !sal.line)
{
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol_by_pc (pc);
if (msym.minsym)
printf_filtered (", <%s>", msym.minsym->linkage_name ());
gdb_printf (", <%s>", msym.minsym->linkage_name ());
}
gdb_putc ('\n');
@ -602,9 +602,9 @@ info_checkpoints_command (const char *arg, int from_tty)
if (printed == NULL)
{
if (requested > 0)
printf_filtered (_("No checkpoint number %d.\n"), requested);
gdb_printf (_("No checkpoint number %d.\n"), requested);
else
printf_filtered (_("No checkpoints.\n"));
gdb_printf (_("No checkpoints.\n"));
}
}
@ -685,15 +685,15 @@ checkpoint_command (const char *args, int from_tty)
{
int parent_pid;
printf_filtered (_("checkpoint %d: fork returned pid %ld.\n"),
fp != NULL ? fp->num : -1, (long) retpid);
gdb_printf (_("checkpoint %d: fork returned pid %ld.\n"),
fp != NULL ? fp->num : -1, (long) retpid);
if (info_verbose)
{
parent_pid = last_target_ptid.lwp ();
if (parent_pid == 0)
parent_pid = last_target_ptid.pid ();
printf_filtered (_(" gdb says parent = %ld.\n"),
(long) parent_pid);
gdb_printf (_(" gdb says parent = %ld.\n"),
(long) parent_pid);
}
}
@ -728,8 +728,8 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
fork_load_infrun_state (newfp);
insert_breakpoints ();
printf_filtered (_("Switching to %s\n"),
target_pid_to_str (inferior_ptid).c_str ());
gdb_printf (_("Switching to %s\n"),
target_pid_to_str (inferior_ptid).c_str ());
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}