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

@ -169,7 +169,7 @@ inferior_debug (int level, const char *fmt, ...)
return;
va_start (ap, fmt);
fprintf_unfiltered (gdb_stdlog, _("[%d inferior]: "), getpid ());
gdb_printf (gdb_stdlog, _("[%d inferior]: "), getpid ());
vfprintf_unfiltered (gdb_stdlog, fmt, ap);
va_end (ap);
}
@ -459,20 +459,20 @@ darwin_resume_inferior (struct inferior *inf)
static void
darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
{
fprintf_unfiltered (gdb_stdlog,
_("message header:\n"));
fprintf_unfiltered (gdb_stdlog,
_(" bits: 0x%x\n"), hdr->msgh_bits);
fprintf_unfiltered (gdb_stdlog,
_(" size: 0x%x\n"), hdr->msgh_size);
fprintf_unfiltered (gdb_stdlog,
_(" remote-port: 0x%x\n"), hdr->msgh_remote_port);
fprintf_unfiltered (gdb_stdlog,
_(" local-port: 0x%x\n"), hdr->msgh_local_port);
fprintf_unfiltered (gdb_stdlog,
_(" reserved: 0x%x\n"), hdr->msgh_reserved);
fprintf_unfiltered (gdb_stdlog,
_(" id: 0x%x\n"), hdr->msgh_id);
gdb_printf (gdb_stdlog,
_("message header:\n"));
gdb_printf (gdb_stdlog,
_(" bits: 0x%x\n"), hdr->msgh_bits);
gdb_printf (gdb_stdlog,
_(" size: 0x%x\n"), hdr->msgh_size);
gdb_printf (gdb_stdlog,
_(" remote-port: 0x%x\n"), hdr->msgh_remote_port);
gdb_printf (gdb_stdlog,
_(" local-port: 0x%x\n"), hdr->msgh_local_port);
gdb_printf (gdb_stdlog,
_(" reserved: 0x%x\n"), hdr->msgh_reserved);
gdb_printf (gdb_stdlog,
_(" id: 0x%x\n"), hdr->msgh_id);
if (disp_body)
{
@ -491,24 +491,24 @@ darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
(mach_msg_port_descriptor_t *)(bod + 1);
int k;
NDR_record_t *ndr;
fprintf_unfiltered (gdb_stdlog,
_("body: descriptor_count=%u\n"),
bod->msgh_descriptor_count);
gdb_printf (gdb_stdlog,
_("body: descriptor_count=%u\n"),
bod->msgh_descriptor_count);
data += sizeof (mach_msg_body_t);
size -= sizeof (mach_msg_body_t);
for (k = 0; k < bod->msgh_descriptor_count; k++)
switch (desc[k].type)
{
case MACH_MSG_PORT_DESCRIPTOR:
fprintf_unfiltered
gdb_printf
(gdb_stdlog,
_(" descr %d: type=%u (port) name=0x%x, dispo=%d\n"),
k, desc[k].type, desc[k].name, desc[k].disposition);
break;
default:
fprintf_unfiltered (gdb_stdlog,
_(" descr %d: type=%u\n"),
k, desc[k].type);
gdb_printf (gdb_stdlog,
_(" descr %d: type=%u\n"),
k, desc[k].type);
break;
}
data += bod->msgh_descriptor_count
@ -516,7 +516,7 @@ darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
size -= bod->msgh_descriptor_count
* sizeof (mach_msg_port_descriptor_t);
ndr = (NDR_record_t *)(desc + bod->msgh_descriptor_count);
fprintf_unfiltered
gdb_printf
(gdb_stdlog,
_("NDR: mig=%02x if=%02x encod=%02x "
"int=%02x char=%02x float=%02x\n"),
@ -526,11 +526,11 @@ darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
size -= sizeof (NDR_record_t);
}
fprintf_unfiltered (gdb_stdlog, _(" data:"));
gdb_printf (gdb_stdlog, _(" data:"));
ldata = (const unsigned int *)data;
for (i = 0; i < size / sizeof (unsigned int); i++)
fprintf_unfiltered (gdb_stdlog, " %08x", ldata[i]);
fprintf_unfiltered (gdb_stdlog, _("\n"));
gdb_printf (gdb_stdlog, " %08x", ldata[i]);
gdb_printf (gdb_stdlog, _("\n"));
}
}
@ -1793,7 +1793,7 @@ darwin_execvp (const char *file, char * const argv[], char * const env[])
res = posix_spawnattr_init (&attr);
if (res != 0)
{
fprintf_unfiltered
gdb_printf
(gdb_stderr, "Cannot initialize attribute for posix_spawn\n");
return;
}
@ -1810,7 +1810,7 @@ darwin_execvp (const char *file, char * const argv[], char * const env[])
res = posix_spawnattr_setflags (&attr, ps_flags);
if (res != 0)
{
fprintf_unfiltered (gdb_stderr, "Cannot set posix_spawn flags\n");
gdb_printf (gdb_stderr, "Cannot set posix_spawn flags\n");
return;
}
@ -1945,11 +1945,11 @@ you \"run\". To prevent these attempts, you can use:\n\
return false;
}
printf_filtered (_("Note: this version of macOS has System Integrity Protection.\n\
gdb_printf (_("Note: this version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb has worked around this by\n\
caching a copy of your shell. The shell used by \"run\" is now:\n\
%s\n"),
new_name.c_str ());
new_name.c_str ());
}
/* We need to make sure that the new name has the correct lifetime. */