diff options
author | Tom Tromey <tom@tromey.com> | 2021-12-30 12:16:58 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-01-05 11:36:33 -0700 |
commit | 7befbbd4c3d50c17fb22d872fd933d8c917aa5ee (patch) | |
tree | d557613e147874cfadab23223b412fd571d6ddbc | |
parent | 34fda50beed954b3fa392297c34c9417a81d7a38 (diff) | |
download | binutils-7befbbd4c3d50c17fb22d872fd933d8c917aa5ee.zip binutils-7befbbd4c3d50c17fb22d872fd933d8c917aa5ee.tar.gz binutils-7befbbd4c3d50c17fb22d872fd933d8c917aa5ee.tar.bz2 |
Use filtered output in some dumping commands
There are several commands that may optionally send their output to a
file -- they take an optional filename argument and open a file. This
patch changes these commands to use filtered output. The rationale
here is that, when printing to gdb_stdout, filtering is appropriate --
it is, and should be, the default for all commands. And, when writing
to a file, paging will not happen anyway (it only happens when the
stream==gdb_stdout), so using the _filtered form will not change
anything.
-rw-r--r-- | gdb/dummy-frame.c | 8 | ||||
-rw-r--r-- | gdb/maint-test-options.c | 32 | ||||
-rw-r--r-- | gdb/regcache-dump.c | 30 | ||||
-rw-r--r-- | gdb/regcache.c | 46 | ||||
-rw-r--r-- | gdb/reggroups.c | 6 |
5 files changed, 61 insertions, 61 deletions
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 70c2777..41c0bde 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -405,10 +405,10 @@ fprint_dummy_frames (struct ui_file *file) struct dummy_frame *s; for (s = dummy_frame_stack; s != NULL; s = s->next) - fprintf_unfiltered (file, "%s: id=%s, ptid=%s\n", - host_address_to_string (s), - s->id.id.to_string ().c_str (), - target_pid_to_str (s->id.thread->ptid).c_str ()); + fprintf_filtered (file, "%s: id=%s, ptid=%s\n", + host_address_to_string (s), + s->id.id.to_string ().c_str (), + target_pid_to_str (s->id.thread->ptid).c_str ()); } static void diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c index 87e810d..b9b538d 100644 --- a/gdb/maint-test-options.c +++ b/gdb/maint-test-options.c @@ -143,22 +143,22 @@ struct test_options_opts arguments. */ void dump (ui_file *file, const char *args) const { - fprintf_unfiltered (file, - _("-flag %d -xx1 %d -xx2 %d -bool %d " - "-enum %s -uint %s -zuint-unl %s -string '%s' -- %s\n"), - flag_opt, - xx1_opt, - xx2_opt, - boolean_opt, - enum_opt, - (uint_opt == UINT_MAX - ? "unlimited" - : pulongest (uint_opt)), - (zuint_unl_opt == -1 - ? "unlimited" - : plongest (zuint_unl_opt)), - string_opt.c_str (), - args); + fprintf_filtered (file, + _("-flag %d -xx1 %d -xx2 %d -bool %d " + "-enum %s -uint %s -zuint-unl %s -string '%s' -- %s\n"), + flag_opt, + xx1_opt, + xx2_opt, + boolean_opt, + enum_opt, + (uint_opt == UINT_MAX + ? "unlimited" + : pulongest (uint_opt)), + (zuint_unl_opt == -1 + ? "unlimited" + : plongest (zuint_unl_opt)), + string_opt.c_str (), + args); } }; diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c index 83c277f..f593450 100644 --- a/gdb/regcache-dump.c +++ b/gdb/regcache-dump.c @@ -43,9 +43,9 @@ protected: if (regnum < 0) { if (m_dump_pseudo) - fprintf_unfiltered (file, "Cooked value"); + fprintf_filtered (file, "Cooked value"); else - fprintf_unfiltered (file, "Raw value"); + fprintf_filtered (file, "Raw value"); } else { @@ -60,9 +60,9 @@ protected: auto status = m_regcache->cooked_read (regnum, buf.data ()); if (status == REG_UNKNOWN) - fprintf_unfiltered (file, "<invalid>"); + fprintf_filtered (file, "<invalid>"); else if (status == REG_UNAVAILABLE) - fprintf_unfiltered (file, "<unavailable>"); + fprintf_filtered (file, "<unavailable>"); else { print_hex_chars (file, buf.data (), size, @@ -73,7 +73,7 @@ protected: { /* Just print "<cooked>" for pseudo register when regcache_dump_raw. */ - fprintf_unfiltered (file, "<cooked>"); + fprintf_filtered (file, "<cooked>"); } } } @@ -102,9 +102,9 @@ protected: if (regnum < 0) { if (m_has_pseudo) - fprintf_unfiltered (file, "Cooked value"); + fprintf_filtered (file, "Cooked value"); else - fprintf_unfiltered (file, "Raw value"); + fprintf_filtered (file, "Raw value"); } else { @@ -120,15 +120,15 @@ protected: gdb_assert (status != REG_VALID); if (status == REG_UNKNOWN) - fprintf_unfiltered (file, "<invalid>"); + fprintf_filtered (file, "<invalid>"); else - fprintf_unfiltered (file, "<unavailable>"); + fprintf_filtered (file, "<unavailable>"); } else { /* Just print "<cooked>" for pseudo register when regcache_dump_raw. */ - fprintf_unfiltered (file, "<cooked>"); + fprintf_filtered (file, "<cooked>"); } } } @@ -162,7 +162,7 @@ protected: { if (regnum < 0) { - fprintf_unfiltered (file, "Rmt Nr g/G Offset"); + fprintf_filtered (file, "Rmt Nr g/G Offset"); } else if (regnum < gdbarch_num_regs (m_gdbarch)) { @@ -170,7 +170,7 @@ protected: if (remote_register_number_and_offset (m_gdbarch, regnum, &pnum, &poffset)) - fprintf_unfiltered (file, "%7d %11d", pnum, poffset); + fprintf_filtered (file, "%7d %11d", pnum, poffset); } } }; @@ -188,7 +188,7 @@ protected: void dump_reg (ui_file *file, int regnum) override { if (regnum < 0) - fprintf_unfiltered (file, "Groups"); + fprintf_filtered (file, "Groups"); else { const char *sep = ""; @@ -200,8 +200,8 @@ protected: { if (gdbarch_register_reggroup_p (m_gdbarch, regnum, group)) { - fprintf_unfiltered (file, - "%s%s", sep, reggroup_name (group)); + fprintf_filtered (file, + "%s%s", sep, reggroup_name (group)); sep = ","; } } diff --git a/gdb/regcache.c b/gdb/regcache.c index f6e2cdd..ab45277 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1436,7 +1436,7 @@ register_dump::dump (ui_file *file) { /* Name. */ if (regnum < 0) - fprintf_unfiltered (file, " %-10s", "Name"); + fprintf_filtered (file, " %-10s", "Name"); else { const char *p = gdbarch_register_name (m_gdbarch, regnum); @@ -1445,31 +1445,31 @@ register_dump::dump (ui_file *file) p = ""; else if (p[0] == '\0') p = "''"; - fprintf_unfiltered (file, " %-10s", p); + fprintf_filtered (file, " %-10s", p); } /* Number. */ if (regnum < 0) - fprintf_unfiltered (file, " %4s", "Nr"); + fprintf_filtered (file, " %4s", "Nr"); else - fprintf_unfiltered (file, " %4d", regnum); + fprintf_filtered (file, " %4d", regnum); /* Relative number. */ if (regnum < 0) - fprintf_unfiltered (file, " %4s", "Rel"); + fprintf_filtered (file, " %4s", "Rel"); else if (regnum < gdbarch_num_regs (m_gdbarch)) - fprintf_unfiltered (file, " %4d", regnum); + fprintf_filtered (file, " %4d", regnum); else - fprintf_unfiltered (file, " %4d", - (regnum - gdbarch_num_regs (m_gdbarch))); + fprintf_filtered (file, " %4d", + (regnum - gdbarch_num_regs (m_gdbarch))); /* Offset. */ if (regnum < 0) - fprintf_unfiltered (file, " %6s ", "Offset"); + fprintf_filtered (file, " %6s ", "Offset"); else { - fprintf_unfiltered (file, " %6ld", - descr->register_offset[regnum]); + fprintf_filtered (file, " %6ld", + descr->register_offset[regnum]); if (register_offset != descr->register_offset[regnum] || (regnum > 0 && (descr->register_offset[regnum] @@ -1479,19 +1479,19 @@ register_dump::dump (ui_file *file) { if (!footnote_register_offset) footnote_register_offset = ++footnote_nr; - fprintf_unfiltered (file, "*%d", footnote_register_offset); + fprintf_filtered (file, "*%d", footnote_register_offset); } else - fprintf_unfiltered (file, " "); + fprintf_filtered (file, " "); register_offset = (descr->register_offset[regnum] + descr->sizeof_register[regnum]); } /* Size. */ if (regnum < 0) - fprintf_unfiltered (file, " %5s ", "Size"); + fprintf_filtered (file, " %5s ", "Size"); else - fprintf_unfiltered (file, " %5ld", descr->sizeof_register[regnum]); + fprintf_filtered (file, " %5ld", descr->sizeof_register[regnum]); /* Type. */ { @@ -1517,24 +1517,24 @@ register_dump::dump (ui_file *file) if (startswith (t, blt)) t += strlen (blt); } - fprintf_unfiltered (file, " %-15s", t); + fprintf_filtered (file, " %-15s", t); } /* Leading space always present. */ - fprintf_unfiltered (file, " "); + fprintf_filtered (file, " "); dump_reg (file, regnum); - fprintf_unfiltered (file, "\n"); + fprintf_filtered (file, "\n"); } if (footnote_register_offset) - fprintf_unfiltered (file, "*%d: Inconsistent register offsets.\n", - footnote_register_offset); + fprintf_filtered (file, "*%d: Inconsistent register offsets.\n", + footnote_register_offset); if (footnote_register_type_name_null) - fprintf_unfiltered (file, - "*%d: Register type's name NULL.\n", - footnote_register_type_name_null); + fprintf_filtered (file, + "*%d: Register type's name NULL.\n", + footnote_register_type_name_null); } #if GDB_SELF_TEST diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 38861c9..2b612fb 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -251,7 +251,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) name = "Group"; else name = reggroup_name (group); - fprintf_unfiltered (file, " %-10s", name); + fprintf_filtered (file, " %-10s", name); } /* Group type. */ @@ -274,13 +274,13 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file) internal_error (__FILE__, __LINE__, _("bad switch")); } } - fprintf_unfiltered (file, " %-10s", type); + fprintf_filtered (file, " %-10s", type); } /* Note: If you change this, be sure to also update the documentation. */ - fprintf_unfiltered (file, "\n"); + fprintf_filtered (file, "\n"); group = reggroup_next (gdbarch, group); } |