aboutsummaryrefslogtreecommitdiff
path: root/gdb/procfs.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-02 11:46:15 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commit6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch)
tree641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/procfs.c
parenta11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff)
downloadgdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2
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.
Diffstat (limited to 'gdb/procfs.c')
-rw-r--r--gdb/procfs.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 4751645..584833a 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1809,7 +1809,7 @@ do_attach (ptid_t ptid)
if (!open_procinfo_files (pi, FD_CTL))
{
- fprintf_filtered (gdb_stderr, "procfs:%d -- ", __LINE__);
+ gdb_printf (gdb_stderr, "procfs:%d -- ", __LINE__);
xsnprintf (errmsg, sizeof (errmsg),
"do_attach: couldn't open /proc file for process %d",
ptid.pid ());
@@ -2122,8 +2122,8 @@ wait_again:
if (what == SYS_lwp_exit)
{
if (print_thread_events)
- printf_filtered (_("[%s exited]\n"),
- target_pid_to_str (retval).c_str ());
+ gdb_printf (_("[%s exited]\n"),
+ target_pid_to_str (retval).c_str ());
delete_thread (find_thread_ptid (this, retval));
target_continue_no_signal (ptid);
goto wait_again;
@@ -2171,9 +2171,9 @@ wait_again:
}
else
{
- printf_filtered (_("procfs: trapped on entry to "));
+ gdb_printf (_("procfs: trapped on entry to "));
proc_prettyprint_syscall (proc_what (pi), 0);
- printf_filtered ("\n");
+ gdb_printf ("\n");
long i, nsysargs, *sysargs;
@@ -2182,11 +2182,11 @@ wait_again:
if (nsysargs > 0 && sysargs != NULL)
{
- printf_filtered (_("%ld syscall arguments:\n"),
- nsysargs);
+ gdb_printf (_("%ld syscall arguments:\n"),
+ nsysargs);
for (i = 0; i < nsysargs; i++)
- printf_filtered ("#%ld: 0x%08lx\n",
- i, sysargs[i]);
+ gdb_printf ("#%ld: 0x%08lx\n",
+ i, sysargs[i]);
}
/* How to keep going without returning to wfi: */
@@ -2229,17 +2229,17 @@ wait_again:
else if (what == SYS_lwp_exit)
{
if (print_thread_events)
- printf_filtered (_("[%s exited]\n"),
- target_pid_to_str (retval).c_str ());
+ gdb_printf (_("[%s exited]\n"),
+ target_pid_to_str (retval).c_str ());
delete_thread (find_thread_ptid (this, retval));
status->set_spurious ();
return retval;
}
else
{
- printf_filtered (_("procfs: trapped on exit from "));
+ gdb_printf (_("procfs: trapped on exit from "));
proc_prettyprint_syscall (proc_what (pi), 0);
- printf_filtered ("\n");
+ gdb_printf ("\n");
long i, nsysargs, *sysargs;
@@ -2248,11 +2248,11 @@ wait_again:
if (nsysargs > 0 && sysargs != NULL)
{
- printf_filtered (_("%ld syscall arguments:\n"),
- nsysargs);
+ gdb_printf (_("%ld syscall arguments:\n"),
+ nsysargs);
for (i = 0; i < nsysargs; i++)
- printf_filtered ("#%ld: 0x%08lx\n",
- i, sysargs[i]);
+ gdb_printf ("#%ld: 0x%08lx\n",
+ i, sysargs[i]);
}
target_continue_no_signal (ptid);
@@ -2266,7 +2266,7 @@ wait_again:
#else
if (retry < 5)
{
- printf_filtered (_("Retry #%d:\n"), retry);
+ gdb_printf (_("Retry #%d:\n"), retry);
pi->status_valid = 0;
goto wait_again;
}
@@ -2297,8 +2297,8 @@ wait_again:
}
break;
default: /* switch (why) unmatched */
- printf_filtered ("procfs:%d -- ", __LINE__);
- printf_filtered (_("child stopped for unknown reason:\n"));
+ gdb_printf ("procfs:%d -- ", __LINE__);
+ gdb_printf (_("child stopped for unknown reason:\n"));
proc_prettyprint_why (why, what, 1);
error (_("... giving up..."));
break;
@@ -2321,8 +2321,8 @@ wait_again:
else /* Flags do not indicate STOPPED. */
{
/* surely this can't happen... */
- printf_filtered ("procfs:%d -- process not stopped.\n",
- __LINE__);
+ gdb_printf ("procfs:%d -- process not stopped.\n",
+ __LINE__);
proc_prettyprint_flags (flags, 1);
error (_("procfs: ...giving up..."));
}
@@ -2537,9 +2537,9 @@ procfs_target::files_info ()
{
struct inferior *inf = current_inferior ();
- printf_filtered (_("\tUsing the running image of %s %s via /proc.\n"),
- inf->attach_flag? "attached": "child",
- target_pid_to_str (inferior_ptid).c_str ());
+ gdb_printf (_("\tUsing the running image of %s %s via /proc.\n"),
+ inf->attach_flag? "attached": "child",
+ target_pid_to_str (inferior_ptid).c_str ());
}
/* Make it die. Wait for it to die. Clean up after it. Note: this
@@ -3228,19 +3228,19 @@ info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
pr_off = (unsigned int) map->pr_offset;
if (gdbarch_addr_bit (target_gdbarch ()) == 32)
- printf_filtered ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
- (unsigned long) map->pr_vaddr,
- (unsigned long) map->pr_vaddr + map->pr_size - 1,
- (unsigned long) map->pr_size,
- pr_off,
- mappingflags (map->pr_mflags));
+ gdb_printf ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
+ (unsigned long) map->pr_vaddr,
+ (unsigned long) map->pr_vaddr + map->pr_size - 1,
+ (unsigned long) map->pr_size,
+ pr_off,
+ mappingflags (map->pr_mflags));
else
- printf_filtered (" %#18lx %#18lx %#10lx %#10x %7s\n",
- (unsigned long) map->pr_vaddr,
- (unsigned long) map->pr_vaddr + map->pr_size - 1,
- (unsigned long) map->pr_size,
- pr_off,
- mappingflags (map->pr_mflags));
+ gdb_printf (" %#18lx %#18lx %#10lx %#10x %7s\n",
+ (unsigned long) map->pr_vaddr,
+ (unsigned long) map->pr_vaddr + map->pr_size - 1,
+ (unsigned long) map->pr_size,
+ pr_off,
+ mappingflags (map->pr_mflags));
return 0;
}
@@ -3253,24 +3253,24 @@ info_proc_mappings (procinfo *pi, int summary)
if (summary)
return; /* No output for summary mode. */
- printf_filtered (_("Mapped address spaces:\n\n"));
+ gdb_printf (_("Mapped address spaces:\n\n"));
if (gdbarch_ptr_bit (target_gdbarch ()) == 32)
- printf_filtered ("\t%10s %10s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size",
- " Offset",
- "Flags");
+ gdb_printf ("\t%10s %10s %10s %10s %7s\n",
+ "Start Addr",
+ " End Addr",
+ " Size",
+ " Offset",
+ "Flags");
else
- printf_filtered (" %18s %18s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size",
- " Offset",
- "Flags");
+ gdb_printf (" %18s %18s %10s %10s %7s\n",
+ "Start Addr",
+ " End Addr",
+ " Size",
+ " Offset",
+ "Flags");
iterate_over_mappings (pi, NULL, NULL, info_mappings_callback);
- printf_filtered ("\n");
+ gdb_printf ("\n");
}
/* Implement the "info proc" command. */
@@ -3339,17 +3339,17 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
if (process)
{
- printf_filtered (_("process %d flags:\n"), process->pid);
+ gdb_printf (_("process %d flags:\n"), process->pid);
proc_prettyprint_flags (proc_flags (process), 1);
if (proc_flags (process) & (PR_STOPPED | PR_ISTOP))
proc_prettyprint_why (proc_why (process), proc_what (process), 1);
if (proc_get_nthreads (process) > 1)
- printf_filtered ("Process has %d threads.\n",
- proc_get_nthreads (process));
+ gdb_printf ("Process has %d threads.\n",
+ proc_get_nthreads (process));
}
if (thread)
{
- printf_filtered (_("thread %d flags:\n"), thread->tid);
+ gdb_printf (_("thread %d flags:\n"), thread->tid);
proc_prettyprint_flags (proc_flags (thread), 1);
if (proc_flags (thread) & (PR_STOPPED | PR_ISTOP))
proc_prettyprint_why (proc_why (thread), proc_what (thread), 1);