diff options
author | Tom Tromey <tom@tromey.com> | 2022-01-02 11:46:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-03-29 12:46:24 -0600 |
commit | 6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch) | |
tree | 641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/netbsd-nat.c | |
parent | a11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff) | |
download | binutils-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip binutils-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz binutils-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/netbsd-nat.c')
-rw-r--r-- | gdb/netbsd-nat.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c index b8389ca..f2eeb3f 100644 --- a/gdb/netbsd-nat.c +++ b/gdb/netbsd-nat.c @@ -247,12 +247,12 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func, size_t size = kve->kve_end - kve->kve_start; if (info_verbose) { - printf_filtered ("Save segment, %ld bytes at %s (%c%c%c)\n", - (long) size, - paddress (target_gdbarch (), kve->kve_start), - kve->kve_protection & KVME_PROT_READ ? 'r' : '-', - kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-', - kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-'); + gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n", + (long) size, + paddress (target_gdbarch (), kve->kve_start), + kve->kve_protection & KVME_PROT_READ ? 'r' : '-', + kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-', + kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-'); } /* Invoke the callback function to create the corefile segment. @@ -322,13 +322,13 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what) else error (_("Invalid arguments.")); - printf_filtered (_("process %d\n"), pid); + gdb_printf (_("process %d\n"), pid); if (do_cmdline) { gdb::unique_xmalloc_ptr<char[]> cmdline = nbsd_pid_to_cmdline (pid); if (cmdline != nullptr) - printf_filtered ("cmdline = '%s'\n", cmdline.get ()); + gdb_printf ("cmdline = '%s'\n", cmdline.get ()); else warning (_("unable to fetch command line")); } @@ -336,7 +336,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what) { std::string cwd = nbsd_pid_to_cwd (pid); if (cwd != "") - printf_filtered ("cwd = '%s'\n", cwd.c_str ()); + gdb_printf ("cwd = '%s'\n", cwd.c_str ()); else warning (_("unable to fetch current working directory")); } @@ -344,7 +344,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what) { const char *exe = pid_to_exec_file (pid); if (exe != nullptr) - printf_filtered ("exe = '%s'\n", exe); + gdb_printf ("exe = '%s'\n", exe); else warning (_("unable to fetch executable path name")); } @@ -398,59 +398,59 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what) } }; - printf_filtered ("Name: %s\n", kp.p_comm); - printf_filtered ("State: %s\n", process_status(kp.p_realstat)); - printf_filtered ("Parent process: %" PRId32 "\n", kp.p_ppid); - printf_filtered ("Process group: %" PRId32 "\n", kp.p__pgid); - printf_filtered ("Session id: %" PRId32 "\n", kp.p_sid); - printf_filtered ("TTY: %" PRId32 "\n", kp.p_tdev); - printf_filtered ("TTY owner process group: %" PRId32 "\n", kp.p_tpgid); - printf_filtered ("User IDs (real, effective, saved): " - "%" PRIu32 " %" PRIu32 " %" PRIu32 "\n", - kp.p_ruid, kp.p_uid, kp.p_svuid); - printf_filtered ("Group IDs (real, effective, saved): " - "%" PRIu32 " %" PRIu32 " %" PRIu32 "\n", - kp.p_rgid, kp.p_gid, kp.p_svgid); - - printf_filtered ("Groups:"); + gdb_printf ("Name: %s\n", kp.p_comm); + gdb_printf ("State: %s\n", process_status(kp.p_realstat)); + gdb_printf ("Parent process: %" PRId32 "\n", kp.p_ppid); + gdb_printf ("Process group: %" PRId32 "\n", kp.p__pgid); + gdb_printf ("Session id: %" PRId32 "\n", kp.p_sid); + gdb_printf ("TTY: %" PRId32 "\n", kp.p_tdev); + gdb_printf ("TTY owner process group: %" PRId32 "\n", kp.p_tpgid); + gdb_printf ("User IDs (real, effective, saved): " + "%" PRIu32 " %" PRIu32 " %" PRIu32 "\n", + kp.p_ruid, kp.p_uid, kp.p_svuid); + gdb_printf ("Group IDs (real, effective, saved): " + "%" PRIu32 " %" PRIu32 " %" PRIu32 "\n", + kp.p_rgid, kp.p_gid, kp.p_svgid); + + gdb_printf ("Groups:"); for (int i = 0; i < kp.p_ngroups; i++) - printf_filtered (" %" PRIu32, kp.p_groups[i]); - printf_filtered ("\n"); - printf_filtered ("Minor faults (no memory page): %" PRIu64 "\n", - kp.p_uru_minflt); - printf_filtered ("Major faults (memory page faults): %" PRIu64 "\n", - kp.p_uru_majflt); - printf_filtered ("utime: %" PRIu32 ".%06" PRIu32 "\n", - kp.p_uutime_sec, kp.p_uutime_usec); - printf_filtered ("stime: %" PRIu32 ".%06" PRIu32 "\n", - kp.p_ustime_sec, kp.p_ustime_usec); - printf_filtered ("utime+stime, children: %" PRIu32 ".%06" PRIu32 "\n", - kp.p_uctime_sec, kp.p_uctime_usec); - printf_filtered ("'nice' value: %" PRIu8 "\n", kp.p_nice); - printf_filtered ("Start time: %" PRIu32 ".%06" PRIu32 "\n", - kp.p_ustart_sec, kp.p_ustart_usec); + gdb_printf (" %" PRIu32, kp.p_groups[i]); + gdb_printf ("\n"); + gdb_printf ("Minor faults (no memory page): %" PRIu64 "\n", + kp.p_uru_minflt); + gdb_printf ("Major faults (memory page faults): %" PRIu64 "\n", + kp.p_uru_majflt); + gdb_printf ("utime: %" PRIu32 ".%06" PRIu32 "\n", + kp.p_uutime_sec, kp.p_uutime_usec); + gdb_printf ("stime: %" PRIu32 ".%06" PRIu32 "\n", + kp.p_ustime_sec, kp.p_ustime_usec); + gdb_printf ("utime+stime, children: %" PRIu32 ".%06" PRIu32 "\n", + kp.p_uctime_sec, kp.p_uctime_usec); + gdb_printf ("'nice' value: %" PRIu8 "\n", kp.p_nice); + gdb_printf ("Start time: %" PRIu32 ".%06" PRIu32 "\n", + kp.p_ustart_sec, kp.p_ustart_usec); int pgtok = getpagesize () / 1024; - printf_filtered ("Data size: %" PRIuMAX " kB\n", - (uintmax_t) kp.p_vm_dsize * pgtok); - printf_filtered ("Stack size: %" PRIuMAX " kB\n", - (uintmax_t) kp.p_vm_ssize * pgtok); - printf_filtered ("Text size: %" PRIuMAX " kB\n", - (uintmax_t) kp.p_vm_tsize * pgtok); - printf_filtered ("Resident set size: %" PRIuMAX " kB\n", - (uintmax_t) kp.p_vm_rssize * pgtok); - printf_filtered ("Maximum RSS: %" PRIu64 " kB\n", kp.p_uru_maxrss); - printf_filtered ("Pending Signals:"); + gdb_printf ("Data size: %" PRIuMAX " kB\n", + (uintmax_t) kp.p_vm_dsize * pgtok); + gdb_printf ("Stack size: %" PRIuMAX " kB\n", + (uintmax_t) kp.p_vm_ssize * pgtok); + gdb_printf ("Text size: %" PRIuMAX " kB\n", + (uintmax_t) kp.p_vm_tsize * pgtok); + gdb_printf ("Resident set size: %" PRIuMAX " kB\n", + (uintmax_t) kp.p_vm_rssize * pgtok); + gdb_printf ("Maximum RSS: %" PRIu64 " kB\n", kp.p_uru_maxrss); + gdb_printf ("Pending Signals:"); for (size_t i = 0; i < ARRAY_SIZE (kp.p_siglist.__bits); i++) - printf_filtered (" %08" PRIx32, kp.p_siglist.__bits[i]); - printf_filtered ("\n"); - printf_filtered ("Ignored Signals:"); + gdb_printf (" %08" PRIx32, kp.p_siglist.__bits[i]); + gdb_printf ("\n"); + gdb_printf ("Ignored Signals:"); for (size_t i = 0; i < ARRAY_SIZE (kp.p_sigignore.__bits); i++) - printf_filtered (" %08" PRIx32, kp.p_sigignore.__bits[i]); - printf_filtered ("\n"); - printf_filtered ("Caught Signals:"); + gdb_printf (" %08" PRIx32, kp.p_sigignore.__bits[i]); + gdb_printf ("\n"); + gdb_printf ("Caught Signals:"); for (size_t i = 0; i < ARRAY_SIZE (kp.p_sigcatch.__bits); i++) - printf_filtered (" %08" PRIx32, kp.p_sigcatch.__bits[i]); - printf_filtered ("\n"); + gdb_printf (" %08" PRIx32, kp.p_sigcatch.__bits[i]); + gdb_printf ("\n"); } } @@ -626,8 +626,8 @@ nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, ourstatus->set_thread_exited (0); if (print_thread_events) - printf_filtered (_("[%s exited]\n"), - target_pid_to_str (wptid).c_str ()); + gdb_printf (_("[%s exited]\n"), + target_pid_to_str (wptid).c_str ()); delete_thread (thr); } @@ -772,11 +772,11 @@ nbsd_nat_target::xfer_partial (enum target_object object, if (res != 0) { if (res == EACCES) - fprintf_unfiltered (gdb_stderr, "Cannot %s process at %s (%s). " - "Is PaX MPROTECT active? See security(7), " - "sysctl(7), paxctl(8)\n", - (writebuf ? "write to" : "read from"), - pulongest (offset), safe_strerror (errno)); + gdb_printf (gdb_stderr, "Cannot %s process at %s (%s). " + "Is PaX MPROTECT active? See security(7), " + "sysctl(7), paxctl(8)\n", + (writebuf ? "write to" : "read from"), + pulongest (offset), safe_strerror (errno)); return TARGET_XFER_E_IO; } if (xfered == 0) |