From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy2-pub.mail.unifiedlayer.com (gproxy2-pub.mail.unifiedlayer.com [69.89.18.3]) by sourceware.org (Postfix) with ESMTPS id AC3623857C7B for ; Sat, 22 Jan 2022 01:38:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AC3623857C7B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw14.mail.unifiedlayer.com (unknown [10.0.90.129]) by progateway4.mail.pro1.eigbox.com (Postfix) with ESMTP id 2395110047789 for ; Sat, 22 Jan 2022 01:38:10 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id B5M1nIXYZ2s5dB5M1nxF1j; Sat, 22 Jan 2022 01:38:10 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=BOh2EHcG c=1 sm=1 tr=0 ts=61eb6002 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=DghFqjY3_ZEA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=x7JJCwmy2PQEFeQNmyQA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=YnmRpLuJpO1MkenmYwT1txtROHXIBceHY7bipThPgUU=; b=O61PGJ6e7oAr2tJuON5EMIj70I 0FquRIgm22PF/Vyr8+QED8Yl0G3BRFFde6+pMGvt5QccLcmNFgc2aJnqmdS0+WEHTguuNu9NczDJB +9U7Rx2l3UpPiN7SLL6/P1lO8; Received: from 75-166-128-165.hlrn.qwest.net ([75.166.128.165]:40604 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nB5M1-001DkZ-C8; Fri, 21 Jan 2022 18:38:09 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 11/19] Unify gdb putc functions Date: Fri, 21 Jan 2022 18:37:53 -0700 Message-Id: <20220122013801.666659-12-tom@tromey.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220122013801.666659-1-tom@tromey.com> References: <20220122013801.666659-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.128.165 X-Source-L: No X-Exim-ID: 1nB5M1-001DkZ-C8 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-128-165.hlrn.qwest.net (prentzel.Home) [75.166.128.165]:40604 X-Source-Auth: tom+tromey.com X-Email-Count: 12 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3031.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2022 01:38:13 -0000 Now that filtered and unfiltered output can be treated identically, we can unify the putc family of functions. This is done under the name "gdb_putc". Most of this patch was written by script. --- gdb/arm-tdep.c | 2 +- gdb/break-catch-sig.c | 2 +- gdb/breakpoint.c | 2 +- gdb/c-lang.c | 10 +++++----- gdb/cli-out.c | 4 ++-- gdb/compile/compile-cplus-types.c | 4 ++-- gdb/dwarf2/loc.c | 8 ++++---- gdb/f-valprint.c | 4 ++-- gdb/guile/scm-ports.c | 2 +- gdb/guile/scm-pretty-print.c | 2 +- gdb/hppa-tdep.c | 2 +- gdb/linux-fork.c | 2 +- gdb/mep-tdep.c | 2 +- gdb/mi/mi-console.c | 8 ++++---- gdb/mi/mi-out.c | 10 +++++----- gdb/mips-tdep.c | 8 ++++---- gdb/p-typeprint.c | 2 +- gdb/remote.c | 4 ++-- gdb/rust-lang.c | 2 +- gdb/s12z-tdep.c | 12 ++++++------ gdb/serial.c | 2 +- gdb/target.c | 2 +- gdb/ui-file.c | 4 +++- gdb/utils.c | 28 ++++++---------------------- gdb/utils.h | 6 ++---- gdb/valprint.c | 6 +++--- 26 files changed, 62 insertions(+), 78 deletions(-) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index fc83ff8b9b7..33b65bdf421 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -4024,7 +4024,7 @@ print_fpu_flags (struct ui_file *file, int flags) gdb_puts ("UFL ", file); if (flags & (1 << 4)) gdb_puts ("INX ", file); - fputc_filtered ('\n', file); + gdb_putc ('\n', file); } /* Print interesting information about the floating point processor diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index e268a102891..b41a9083ccd 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -296,7 +296,7 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp) } else if (c->catch_all) fprintf_unfiltered (fp, " all"); - fputc_unfiltered ('\n', fp); + gdb_putc ('\n', fp); } /* Implement the "explains_signal" breakpoint_ops method for signal diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 9567c737cab..0cdb848cea7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11052,7 +11052,7 @@ clear_command (const char *arg, int from_tty) delete_breakpoint (iter); } if (from_tty) - putchar_filtered ('\n'); + gdb_putc ('\n'); } /* Delete breakpoint in BS if they are `delete' breakpoints and diff --git a/gdb/c-lang.c b/gdb/c-lang.c index fa1b73c718f..d5dd7fd2400 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -167,19 +167,19 @@ language_defn::printchar (int c, struct type *type, case C_CHAR: break; case C_WIDE_CHAR: - fputc_filtered ('L', stream); + gdb_putc ('L', stream); break; case C_CHAR_16: - fputc_filtered ('u', stream); + gdb_putc ('u', stream); break; case C_CHAR_32: - fputc_filtered ('U', stream); + gdb_putc ('U', stream); break; } - fputc_filtered ('\'', stream); + gdb_putc ('\'', stream); emitchar (c, type, stream, '\''); - fputc_filtered ('\'', stream); + gdb_putc ('\'', stream); } /* Print the character string STRING, printing at most LENGTH diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 0c87a820568..47b256bd97e 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -381,9 +381,9 @@ void cli_ui_out::field_separator () { if (test_flags (unfiltered_output)) - fputc_unfiltered (' ', m_streams.back ()); + gdb_putc (' ', m_streams.back ()); else - fputc_filtered (' ', m_streams.back ()); + gdb_putc (' ', m_streams.back ()); } /* Constructor for cli_ui_out. */ diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index a76abea977a..9b24857dfa9 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -1267,7 +1267,7 @@ static void compile_cplus_debug_output (T arg, Targs... Args) { compile_cplus_debug_output_1 (arg); - fputc_unfiltered (' ', gdb_stdlog); + gdb_putc (' ', gdb_stdlog); compile_cplus_debug_output (Args...); } @@ -1277,7 +1277,7 @@ compile_cplus_debug_output (T arg, Targs... Args) { \ gdb_puts (": ", gdb_stdlog); \ compile_cplus_debug_output (R); \ - fputc_unfiltered ('\n', gdb_stdlog); \ + gdb_putc ('\n', gdb_stdlog); \ } \ #define GCC_METHOD0(R, N) \ diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index a9aa0d5b7a0..73f37ad9c0b 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -862,7 +862,7 @@ chain_candidate (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "tailcall: initial:"); for (idx = 0; idx < length; idx++) tailcall_dump (gdbarch, result->call_site[idx]); - fputc_unfiltered ('\n', gdb_stdlog); + gdb_putc ('\n', gdb_stdlog); } return; @@ -873,7 +873,7 @@ chain_candidate (struct gdbarch *gdbarch, fprintf_unfiltered (gdb_stdlog, "tailcall: compare:"); for (idx = 0; idx < length; idx++) tailcall_dump (gdbarch, chain->at (idx)); - fputc_unfiltered ('\n', gdb_stdlog); + gdb_putc ('\n', gdb_stdlog); } /* Intersect callers. */ @@ -907,7 +907,7 @@ chain_candidate (struct gdbarch *gdbarch, tailcall_dump (gdbarch, (*resultp)->call_site[(*resultp)->length - (*resultp)->callees + idx]); - fputc_unfiltered ('\n', gdb_stdlog); + gdb_putc ('\n', gdb_stdlog); } if ((*resultp)->callers == 0 && (*resultp)->callees == 0) @@ -3621,7 +3621,7 @@ disassemble_dwarf_expression (struct ui_file *stream, case DW_OP_entry_value: case DW_OP_GNU_entry_value: data = safe_read_uleb128 (data, end, &ul); - fputc_filtered ('\n', stream); + gdb_putc ('\n', stream); disassemble_dwarf_expression (stream, arch, addr_size, offset_size, start, data, data + ul, indent + 2, all, per_cu, per_objfile); diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index fa036355c1c..ad1fae29efc 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -607,7 +607,7 @@ info_common_command_for_block (const struct block *block, const char *comname, continue; if (*any_printed) - putchar_filtered ('\n'); + gdb_putc ('\n'); else *any_printed = 1; if (sym->print_name ()) @@ -636,7 +636,7 @@ info_common_command_for_block (const struct block *block, const char *comname, except.what ()); } - putchar_filtered ('\n'); + gdb_putc ('\n'); } } } diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c index c61ca1dafc4..946859aa1f3 100644 --- a/gdb/guile/scm-ports.c +++ b/gdb/guile/scm-ports.c @@ -204,7 +204,7 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream) if (s[i] == '\0') gdb_puts ("\\000", stream); else - fputc_filtered (s[i], stream); + gdb_putc (s[i], stream); } } diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 8a5c02d0adb..707ef4be4e4 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -689,7 +689,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint, if (string.get ()[i] == '\0') gdb_puts ("\\000", stream); else - fputc_filtered (string.get ()[i], stream); + gdb_putc (string.get ()[i], stream); } } result = STRING_REPR_OK; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 32c54357045..682028d6fe8 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2609,7 +2609,7 @@ unwind_command (const char *exp, int from_tty) pif (Large_frame); pif (alloca_frame); - putchar_filtered ('\n'); + gdb_putc ('\n'); #define pin(FLD) printf_filtered ("\t"#FLD" = 0x%x\n", u->FLD); diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index e7e25b5eae6..8cea33d793f 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -597,7 +597,7 @@ info_checkpoints_command (const char *arg, int from_tty) printf_filtered (", <%s>", msym.minsym->linkage_name ()); } - putchar_filtered ('\n'); + gdb_putc ('\n'); } if (printed == NULL) { diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 11d79a0e9e7..696d9c63bce 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -2369,7 +2369,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) const char *file_endianness = bfd_big_endian (info.abfd) ? "big" : "little"; - fputc_unfiltered ('\n', gdb_stderr); + gdb_putc ('\n', gdb_stderr); if (module_name) warning (_("the MeP module '%s' is %s-endian, but the executable\n" "%s is %s-endian."), diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c index 5043e9b475d..5cdb486be5e 100644 --- a/gdb/mi/mi-console.c +++ b/gdb/mi/mi-console.c @@ -79,15 +79,15 @@ mi_console_file::flush () gdb_puts (m_prefix, m_raw); if (m_quote) { - fputc_unfiltered (m_quote, m_raw); + gdb_putc (m_quote, m_raw); m_raw->putstrn (buf, length_buf, m_quote); - fputc_unfiltered (m_quote, m_raw); - fputc_unfiltered ('\n', m_raw); + gdb_putc (m_quote, m_raw); + gdb_putc ('\n', m_raw); } else { m_raw->putstrn (buf, length_buf, 0); - fputc_unfiltered ('\n', m_raw); + gdb_putc ('\n', m_raw); } gdb_flush (m_raw); } diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index ff93cb3ba10..c84cc55e4c1 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -199,7 +199,7 @@ mi_ui_out::field_separator () if (m_suppress_field_separator) m_suppress_field_separator = false; else - fputc_unfiltered (',', m_streams.back ()); + gdb_putc (',', m_streams.back ()); } void @@ -216,11 +216,11 @@ mi_ui_out::open (const char *name, ui_out_type type) switch (type) { case ui_out_type_tuple: - fputc_unfiltered ('{', stream); + gdb_putc ('{', stream); break; case ui_out_type_list: - fputc_unfiltered ('[', stream); + gdb_putc ('[', stream); break; default: @@ -236,11 +236,11 @@ mi_ui_out::close (ui_out_type type) switch (type) { case ui_out_type_tuple: - fputc_unfiltered ('}', stream); + gdb_putc ('}', stream); break; case ui_out_type_list: - fputc_unfiltered (']', stream); + gdb_putc (']', stream); break; default: diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 299e8a0cc52..d784f9ea3d3 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -6423,7 +6423,7 @@ print_fpu_flags (struct ui_file *file, int flags) gdb_puts (" inval", file); if (flags & (1 << 5)) gdb_puts (" unimp", file); - fputc_filtered ('\n', file); + gdb_putc ('\n', file); } /* Print interesting information about the floating point processor @@ -6458,7 +6458,7 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, for (i = 1; i <= 7; i++) if (fcs & (1 << (24 + i))) fprintf_filtered (file, " %d", i); - fputc_filtered ('\n', file); + gdb_putc ('\n', file); gdb_puts ("cause :", file); print_fpu_flags (file, (fcs >> 12) & 0x3f); @@ -6485,11 +6485,11 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, gdb_puts (" zero", file); if ((fcs & (0xb << 21)) == 0) gdb_puts (" no", file); - fputc_filtered ('\n', file); + gdb_putc ('\n', file); fprintf_filtered (file, "nan2008 : %s\n", fcs & (1 << 18) ? "yes" : "no"); fprintf_filtered (file, "abs2008 : %s\n", fcs & (1 << 19) ? "yes" : "no"); - fputc_filtered ('\n', file); + gdb_putc ('\n', file); default_print_float_info (gdbarch, file, frame, args); } diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 98bbee97988..f8bdf72cf4a 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -152,7 +152,7 @@ pascal_language::type_print_method_args (const char *physname, physname += len; for (j = 0; j < i; ++j) - fputc_filtered (physname[j], stream); + gdb_putc (physname[j], stream); physname += i; if (physname[0] != 0) diff --git a/gdb/remote.c b/gdb/remote.c index 6746aa851bc..be5b759b0c2 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11585,7 +11585,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf) { char c = (fromhex (p[0]) << 4) + fromhex (p[1]); - fputc_unfiltered (c, outbuf); + gdb_putc (c, outbuf); } break; } @@ -11642,7 +11642,7 @@ struct cli_packet_command_callbacks : public send_remote_packet_callbacks { gdb_byte c = buf[i]; if (isprint (c)) - fputc_unfiltered (c, &stb); + gdb_putc (c, &stb); else fprintf_unfiltered (&stb, "\\x%02x", (unsigned char) c); } diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 110a429a47f..d37b04b824c 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1600,7 +1600,7 @@ rust_language::emitchar (int ch, struct type *chtype, else if (ch == '\0') gdb_puts ("\\0", stream); else if (ch >= 32 && ch <= 127 && isprint (ch)) - fputc_filtered (ch, stream); + gdb_putc (ch, stream); else if (ch <= 255) fprintf_filtered (stream, "\\x%02x", ch); else diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c index 97f6f4a6f80..40cd3d1da1b 100644 --- a/gdb/s12z-tdep.c +++ b/gdb/s12z-tdep.c @@ -527,23 +527,23 @@ s12z_print_ccw_info (struct gdbarch *gdbarch, const int stop_1 = 15; const int stop_2 = 17; for (int i = 0; i < stop_1 - len; ++i) - fputc_filtered (' ', file); + gdb_putc (' ', file); fprintf_filtered (file, "0x%04x", ccw); for (int i = 0; i < stop_2 - len; ++i) - fputc_filtered (' ', file); + gdb_putc (' ', file); for (int b = 15; b >= 0; --b) { if (ccw & (0x1u << b)) { if (ccw_bits[b] == 0) - fputc_filtered ('1', file); + gdb_putc ('1', file); else - fputc_filtered (ccw_bits[b], file); + gdb_putc (ccw_bits[b], file); } else - fputc_filtered (tolower (ccw_bits[b]), file); + gdb_putc (tolower (ccw_bits[b]), file); } - fputc_filtered ('\n', file); + gdb_putc ('\n', file); } static void diff --git a/gdb/serial.c b/gdb/serial.c index 347ab2e098f..1508c5de2c3 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -70,7 +70,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout) } if (serial_logbase != logbase_ascii) - fputc_unfiltered (' ', stream); + gdb_putc (' ', stream); switch (ch) { diff --git a/gdb/target.c b/gdb/target.c index b53e5b6098e..97e8e125b5d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1785,7 +1785,7 @@ target_xfer_partial (struct target_ops *ops, } } - fputc_unfiltered ('\n', gdb_stdlog); + gdb_putc ('\n', gdb_stdlog); } /* Check implementations of to_xfer_partial update *XFERED_LEN diff --git a/gdb/ui-file.c b/gdb/ui-file.c index ec441a73a8c..afb12b408f5 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -63,7 +63,9 @@ ui_file::putstrn (const char *str, int n, int quoter, bool async_safe) int ui_file::putc (int c) { - return fputc_unfiltered (c, this); + char copy = (char) c; + write (©, 1); + return c; } void diff --git a/gdb/utils.c b/gdb/utils.c index b07852bcc74..04f2f38bd7b 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1779,7 +1779,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight, /* Output the part before pmatch with current style. */ while (pmatch.rm_so > 0) { - fputc_filtered (*str, stream); + gdb_putc (*str, stream); pmatch.rm_so--; str++; } @@ -1788,7 +1788,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight, stream->emit_style_escape (highlight_style.style ()); while (n_highlight > 0) { - fputc_filtered (*str, stream); + gdb_putc (*str, stream); n_highlight--; str++; } @@ -1804,31 +1804,15 @@ fputs_highlighted (const char *str, const compiled_regex &highlight, May return nonlocally. */ int -putchar_filtered (int c) +gdb_putc (int c) { - return fputc_filtered (c, gdb_stdout); + return gdb_stdout->putc (c); } int -fputc_unfiltered (int c, struct ui_file *stream) +gdb_putc (int c, struct ui_file *stream) { - char buf[2]; - - buf[0] = c; - buf[1] = 0; - gdb_puts (buf, stream); - return c; -} - -int -fputc_filtered (int c, struct ui_file *stream) -{ - char buf[2]; - - buf[0] = c; - buf[1] = 0; - gdb_puts (buf, stream); - return c; + return stream->putc (c); } void diff --git a/gdb/utils.h b/gdb/utils.h index ec595e993c0..0c629ae2908 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -232,11 +232,9 @@ extern void set_screen_width_and_height (int width, int height); extern void gdb_puts (const char *, struct ui_file *); -extern int fputc_filtered (int c, struct ui_file *); +extern int gdb_putc (int c, struct ui_file *); -extern int fputc_unfiltered (int c, struct ui_file *); - -extern int putchar_filtered (int c); +extern int gdb_putc (int c); extern void gdb_puts (const char *); diff --git a/gdb/valprint.c b/gdb/valprint.c index ff215fbc9df..9a8de15e5eb 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1396,7 +1396,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, b = '0'; if (zero_pad || seen_a_one || b == '1') - fputc_filtered (b, stream); + gdb_putc (b, stream); if (b == '1') seen_a_one = true; } @@ -1416,7 +1416,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, b = '0'; if (zero_pad || seen_a_one || b == '1') - fputc_filtered (b, stream); + gdb_putc (b, stream); if (b == '1') seen_a_one = true; } @@ -1426,7 +1426,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, /* When not zero-padding, ensure that something is printed when the input is 0. */ if (!zero_pad && !seen_a_one) - fputc_filtered ('0', stream); + gdb_putc ('0', stream); } /* A helper for print_octal_chars that emits a single octal digit, -- 2.31.1