From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oXzeE+1H0mnfgAgAWB0awg (envelope-from ) for ; Sun, 05 Apr 2026 07:30:53 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=eacuUcv6; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4A4141E0BC; Sun, 05 Apr 2026 07:30:53 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 214E31E04F for ; Sun, 05 Apr 2026 07:30:51 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id BE2F94BA2E27 for ; Sun, 5 Apr 2026 11:30:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE2F94BA2E27 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=eacuUcv6 Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id A31124BA2E27 for ; Sun, 5 Apr 2026 11:28:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A31124BA2E27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A31124BA2E27 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775388522; cv=none; b=cnrxLG3SyPZQ3tYK5FGS2ArfphdIgGGrwcq2X/BQaQgipXvNdVYNxKj8GcjiHbftmOe7rfaij3oXv6Okm6kvFXOAdKHVaJYrYVswr1uogjedb3Xc1WkSAghSVjp3XBsz5W+pvzkEFUhZ0eCRUeMHr6yvvPF6AGfXTPmh8oBk1X0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775388522; c=relaxed/simple; bh=bnU1aBqPU3AQL08od/UEtnnO0c9lwkeaegYk0fyACVE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=TEKKwz7D0sA2YWD2QTRR7t9hI2BDKvec5FZbdHwBmxlc3KbAHAMRXxfpO2Asvxos2KXFHn6YNIOoMufJqk/JKgQLcxJ9RZdbAbk3AYCS7YIf2QGuVyGLK0FCY/05M745CnT29NRK0zcOtYBaMxCT8Mfkp+hctwkK3TY36tBMZeI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A31124BA2E27 Received: from eig-obgw-6001b.ext.cloudfilter.net ([10.0.30.143]) by cmsmtp with ESMTPS id 93Pnw4uaRObRf9LejwCLow; Sun, 05 Apr 2026 11:28:41 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 9LegwbJYQYA8x9LegwSRYR; Sun, 05 Apr 2026 11:28:38 +0000 X-Authority-Analysis: v=2.4 cv=VJfdn8PX c=1 sm=1 tr=0 ts=69d24766 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=ItBw4LHWJt0A:10 a=PPFlet8c6LS6BD71bBwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To: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=0foOhLFboXGlQ3DSwObQfgFT1ufEp2mdr8yted4sVeQ=; b=eacuUcv63gqP+07WjOOs5fPK6/ fjD/OnnpEqljfsyTL3wGb6O95yYgqBdhid9r2ej9R+RimrWvIAwwPWx7Jj7rjF7tqvhv6s9JP+ob+ Je1ozKVZ+aEjJbp5KpIYFv+pn; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:42722 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9Leg-00000001QMu-0Cgu; Sun, 05 Apr 2026 05:28:38 -0600 From: Tom Tromey Date: Sun, 05 Apr 2026 05:28:39 -0600 Subject: [PATCH 2/4] Add filename styling to error messages MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260405-more-error-style-v1-2-6c04da718875@tromey.com> References: <20260405-more-error-style-v1-0-6c04da718875@tromey.com> In-Reply-To: <20260405-more-error-style-v1-0-6c04da718875@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 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.225.82 X-Source-L: No X-Exim-ID: 1w9Leg-00000001QMu-0Cgu X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:42722 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHdzUKgfj33t6u5U+vuH3rlU7y+pWkeDIy2svevBJIKUh5D0xZW+UvtI/PNijE+427i9+GNlqYs05Ji8pOHsfrOv1CDuvUtymSSv0RKcDopM52HqDjNl yu29+PdVw0QBseVrNJ/bWKLf4dOVaMOjasVKxf/GFA3jWVisQR6J56chhirdOPXMo3oHJ5cRK2Pf/k+/UJI84yjk35qYQwTGL5s= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This changes a number of error messages in gdb to use file_name_style. --- gdb/amd64-linux-tdep.c | 5 +++-- gdb/breakpoint.c | 12 ++++++++---- gdb/cli/cli-cmds.c | 5 +++-- gdb/cli/cli-dump.c | 21 ++++++++++++++------- gdb/coffread.c | 19 +++++++++++++------ gdb/compile/compile-object-load.c | 36 +++++++++++++++++++++--------------- gdb/corelow.c | 10 ++++++---- gdb/ctfread.c | 16 ++++++++++------ gdb/dwarf2/dwz.c | 9 +++++---- gdb/exec.c | 10 +++++----- gdb/gcore.c | 9 ++++++--- gdb/gdb_bfd.c | 12 ++++++++---- gdb/linespec.c | 1 + gdb/linux-nat.c | 4 +++- gdb/record-full.c | 25 +++++++++++++++---------- gdb/remote.c | 3 ++- gdb/skip.c | 5 +++-- gdb/solib-aix.c | 16 ++++++++++------ gdb/solib-darwin.c | 7 +++++-- gdb/solib.c | 14 +++++++++----- gdb/symfile.c | 30 ++++++++++++++++++------------ gdb/symmisc.c | 3 ++- gdb/target.c | 34 ++++++++++++++++++++++------------ gdb/tracectf.c | 16 ++++++++++------ gdb/tracefile-tfile.c | 6 ++++-- gdb/utils.c | 4 +++- gdb/xcoffread.c | 6 ++++-- gdb/xml-support.c | 5 ++++- 28 files changed, 217 insertions(+), 126 deletions(-) diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 17d9f78f32d..a5ac26654cf 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -50,6 +50,7 @@ #include "x86-tdep.h" #include "dwarf2/frame.h" #include "frame-unwind.h" +#include "cli/cli-style.h" /* The syscall's XML filename for i386. */ #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" @@ -1868,8 +1869,8 @@ amd64_linux_lam_untag_mask () errno = 0; unsigned long long result = std::strtoul (start, &endptr, 0); if (errno != 0 || endptr == start) - error (_("Failed to parse untag_mask from file %s."), - std::string (filename).c_str ()); + error (_("Failed to parse untag_mask from file %ps."), + styled_string (file_name_style.style (), filename.c_str ())); return result; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fdff6e8fc94..13e25067056 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9498,8 +9498,10 @@ resolve_sal_pc (struct symtab_and_line *sal) if (sal->pc == 0 && sal->symtab != NULL) { if (!find_pc_for_line (sal->symtab, sal->line, &pc)) - error (_("No line %d in file \"%s\"."), - sal->line, symtab_to_filename_for_display (sal->symtab)); + error (_("No line %d in file \"%ps\"."), + sal->line, + styled_string (file_name_style.style (), + symtab_to_filename_for_display (sal->symtab))); sal->pc = pc; /* If this SAL corresponds to a breakpoint inserted using a line @@ -14543,8 +14545,10 @@ save_breakpoints (const char *filename, int from_tty, stdio_file fp; if (!fp.open (expanded_filename.get (), "w")) - error (_("Unable to open file '%s' for saving (%s)"), - expanded_filename.get (), safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving (%s)"), + styled_string (file_name_style.style (), + expanded_filename.get ()), + safe_strerror (errno)); if (extra_trace_bits) save_trace_state_variables (&fp); diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 761158f2ae9..63f5a637697 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1902,8 +1902,9 @@ save_user_command (const char *filename, int from_tty) std::string expanded_filename = gdb_tilde_expand (filename); stdio_file fp; if (!fp.open (expanded_filename.c_str (), "w")) - error (_("Unable to open file '%s' for saving (%s)"), - expanded_filename.c_str (), safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving (%s)"), + styled_string (file_name_style.style (), expanded_filename.c_str ()), + safe_strerror (errno)); cli_ui_out uiout (&fp); for (struct cmd_list_element *c = cmdlist; c != nullptr; c = c->next) diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 59c5827c093..66ab5922693 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -31,6 +31,7 @@ #include "gdbsupport/byte-vector.h" #include "gdbarch.h" #include "inferior.h" +#include "cli/cli-style.h" static gdb::unique_xmalloc_ptr scan_expression (const char **cmd, const char *def) @@ -84,11 +85,13 @@ bfd_openr_or_error (const char *filename, const char *target) { gdb_bfd_ref_ptr ibfd (gdb_bfd_openr (filename, target)); if (ibfd == NULL) - error (_("Failed to open %s: %s."), filename, + error (_("Failed to open %ps: %s."), + styled_string (file_name_style.style (), filename), bfd_errmsg (bfd_get_error ())); if (!bfd_check_format (ibfd.get (), bfd_object)) - error (_("'%s' is not a recognized file format."), filename); + error (_("'%ps' is not a recognized file format."), + styled_string (file_name_style.style (), filename)); return ibfd; } @@ -102,7 +105,8 @@ bfd_openw_or_error (const char *filename, const char *target, const char *mode) { obfd = gdb_bfd_openw (filename, target); if (obfd == NULL) - error (_("Failed to open %s: %s."), filename, + error (_("Failed to open %ps: %s."), + styled_string (file_name_style.style (), filename), bfd_errmsg (bfd_get_error ())); if (!bfd_set_format (obfd.get (), bfd_object)) error (_("bfd_openw_or_error: %s."), bfd_errmsg (bfd_get_error ())); @@ -414,7 +418,8 @@ restore_one_section (bfd *ibfd, asection *isec, /* Get the data. */ gdb::byte_vector buf (size); if (!bfd_get_section_contents (ibfd, isec, buf.data (), 0, size)) - error (_("Failed to read bfd file %s: '%s'."), bfd_get_filename (ibfd), + error (_("Failed to read bfd file %ps: '%s'."), + styled_string (file_name_style.style (), bfd_get_filename (ibfd)), bfd_errmsg (bfd_get_error ())); gdb_printf ("Restoring section %s (0x%lx to 0x%lx)", @@ -449,7 +454,9 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset, long len; if (file == NULL) - error (_("Failed to open %s: %s"), filename, safe_strerror (errno)); + error (_("Failed to open %ps: %s"), + styled_string (file_name_style.style (), filename), + safe_strerror (errno)); /* Get the file size for reading. */ if (fseek (file.get (), 0, SEEK_END) == 0) @@ -462,8 +469,8 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset, perror_with_name (filename); if (len <= load_start) - error (_("Start address is greater than length of binary file %s."), - filename); + error (_("Start address is greater than length of binary file %ps."), + styled_string (file_name_style.style (), filename)); /* Chop off "len" if it exceeds the requested load_end addr. */ if (load_end != 0 && load_end < len) diff --git a/gdb/coffread.c b/gdb/coffread.c index f45b5efd5b3..0a5da42e563 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -27,6 +27,7 @@ #include "target.h" #include "dwarf2/public.h" #include "coff-pe-read.h" +#include "cli/cli-style.h" /* Simplified internal version of coff symbol table information. */ @@ -324,7 +325,8 @@ coff_reader::symfile_read (symfile_add_flags symfile_flags) gdb::unique_xmalloc_ptr stringtab_storage; val = init_stringtab (stringtab_offset, &stringtab_storage); if (val < 0) - error (_("\"%s\": can't get string table"), filename); + error (_("\"%ps\": can't get string table"), + styled_string (file_name_style.style (), filename)); read_minsyms (symtab_offset, num_symbols); @@ -386,8 +388,10 @@ coff_reader::symtab_read (minimal_symbol_reader &reader, /* Position to read the symbol table. */ val = bfd_seek (symfile_bfd, symtab_offset, 0); if (val < 0) - error (_("Error reading symbols from %s: %s"), - objfile_name (coffread_objfile), bfd_errmsg (bfd_get_error ())); + error (_("Error reading symbols from %ps: %s"), + styled_string (file_name_style.style (), + objfile_name (coffread_objfile)), + bfd_errmsg (bfd_get_error ())); while (symnum < nsyms) { @@ -530,7 +534,9 @@ coff_reader::read_one_sym (struct coff_symbol *cs) bytes = bfd_read (temp_sym, local_symesz, symfile_bfd); if (bytes != local_symesz) - error (_("%s: error reading symbols"), objfile_name (coffread_objfile)); + error (_("%ps: error reading symbols"), + styled_string (file_name_style.style (), + objfile_name (coffread_objfile))); bfd_coff_swap_sym_in (symfile_bfd, temp_sym, &sym); cs->c_naux = sym.n_numaux & 0xff; if (cs->c_naux >= 1) @@ -540,8 +546,9 @@ coff_reader::read_one_sym (struct coff_symbol *cs) { bytes = bfd_read (temp_aux, local_auxesz, symfile_bfd); if (bytes != local_auxesz) - error (_("%s: error reading symbols"), - objfile_name (coffread_objfile)); + error (_("%ps: error reading symbols"), + styled_string (file_name_style.style (), + objfile_name (coffread_objfile))); } } cs->c_name = getsymname (&sym); diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index fe48979e4f6..4ea924582fb 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -31,6 +31,7 @@ #include "block.h" #include "arch-utils.h" #include +#include "cli/cli-style.h" /* Add inferior mmap memory range ADDR..ADDR+SIZE (exclusive) to the list. */ @@ -616,16 +617,18 @@ compile_object_load (const compile_file_names &file_names, gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget)); if (abfd == NULL) - error (_("\"%s\": could not open as compiled module: %s"), - filename.get (), bfd_errmsg (bfd_get_error ())); + error (_("\"%ps\": could not open as compiled module: %s"), + styled_string (file_name_style.style (), filename.get ()), + bfd_errmsg (bfd_get_error ())); if (!bfd_check_format_matches (abfd.get (), bfd_object, &matching)) - error (_("\"%s\": not in loadable format: %s"), - filename.get (), + error (_("\"%ps\": not in loadable format: %s"), + styled_string (file_name_style.style (), filename.get ()), gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); if ((bfd_get_file_flags (abfd.get ()) & (EXEC_P | DYNAMIC)) != 0) - error (_("\"%s\": not in object format."), filename.get ()); + error (_("\"%ps\": not in object format."), + styled_string (file_name_style.style (), filename.get ())); struct setup_sections_data setup_sections_data (abfd.get ()); for (asection *sect : gdb_bfd_sections (abfd)) @@ -644,14 +647,15 @@ compile_object_load (const compile_file_names &file_names, GCC_FE_WRAPPER_FUNCTION, SEARCH_VFT).symbol; if (func_sym == NULL) - error (_("Cannot find function \"%s\" in compiled module \"%s\"."), - GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); + error (_("Cannot find function \"%s\" in compiled module \"%ps\"."), + GCC_FE_WRAPPER_FUNCTION, + styled_string (file_name_style.style (), objfile_name (objfile))); func_type = func_sym->type (); if (func_type->code () != TYPE_CODE_FUNC) error (_("Invalid type code %d of function \"%s\" in compiled " - "module \"%s\"."), + "module \"%ps\"."), func_type->code (), GCC_FE_WRAPPER_FUNCTION, - objfile_name (objfile)); + styled_string (file_name_style.style (), objfile_name (objfile))); switch (scope) { @@ -676,13 +680,14 @@ compile_object_load (const compile_file_names &file_names, } if (func_type->num_fields () != expect_parameters) error (_("Invalid %d parameters of function \"%s\" in compiled " - "module \"%s\"."), + "module \"%ps\"."), func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION, - objfile_name (objfile)); + styled_string (file_name_style.style (), objfile_name (objfile))); if (!types_deeply_equal (expect_return_type, func_type->target_type ())) error (_("Invalid return type of function \"%s\" in compiled " - "module \"%s\"."), - GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile)); + "module \"%ps\"."), + GCC_FE_WRAPPER_FUNCTION, + styled_string (file_name_style.style (), objfile_name (objfile))); gdb::array_view symbol_table = gdb_bfd_canonicalize_symtab (abfd.get ()); @@ -774,8 +779,9 @@ compile_object_load (const compile_file_names &file_names, break; default: warning (_("Could not find symbol \"%s\" " - "for compiled module \"%s\"."), - sym->name, filename.get ()); + "for compiled module \"%ps\"."), + sym->name, + styled_string (file_name_style.style (), filename.get ())); missing_symbols++; } } diff --git a/gdb/corelow.c b/gdb/corelow.c index 954607134f4..8548311b906 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -377,8 +377,9 @@ core_target::core_target (gdb_bfd_ref_ptr cbfd_ref) if (!m_core_gdbarch || !gdbarch_iterate_over_regset_sections_p (m_core_gdbarch)) - error (_("\"%s\": Core file format not supported"), - bfd_get_filename (this->core_bfd ())); + error (_("\"%ps\": Core file format not supported"), + styled_string (file_name_style.style (), + bfd_get_filename (this->core_bfd ()))); /* Find the data section */ m_core_section_table = build_section_table (this->core_bfd ()); @@ -1041,8 +1042,9 @@ core_target_open (const char *arg, int from_tty) /* FIXME: should be checking for errors from bfd_close (for one thing, on error it does not free all the storage associated with the bfd). */ - error (_("\"%s\" is not a core dump: %s"), - filename.c_str (), bfd_errmsg (bfd_get_error ())); + error (_("\"%ps\" is not a core dump: %s"), + styled_string (file_name_style.style (), filename.c_str ()), + bfd_errmsg (bfd_get_error ())); } core_target *target = new core_target (std::move (temp_bfd)); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index b95cdbed33c..0ddb2325344 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -84,6 +84,7 @@ #include "maint.h" #include "objfiles.h" #include "progspace.h" +#include "cli/cli-style.h" /* When true, print debug messages related to CTF reading. */ static bool debug_ctf = false; @@ -1305,13 +1306,15 @@ elfctf_build_symtabs (objfile *objfile) ctf_archive_up archive (ctf_bfdopen (abfd, &err)); if (archive == nullptr) - error (_("ctf_bfdopen failed on %s - %s"), - bfd_get_filename (abfd), ctf_errmsg (err)); + error (_("ctf_bfdopen failed on %ps - %s"), + styled_string (file_name_style.style (), bfd_get_filename (abfd)), + ctf_errmsg (err)); ctf_dict_up dict (ctf_dict_open (archive.get (), NULL, &err)); if (dict == nullptr) - error (_("ctf_dict_open failed on %s - %s"), - bfd_get_filename (abfd), ctf_errmsg (err)); + error (_("ctf_dict_open failed on %ps - %s"), + styled_string (file_name_style.style (), bfd_get_filename (abfd)), + ctf_errmsg (err)); ctf_per_objfile &per_objfile = ctf_per_objfile_key.emplace (objfile, objfile, std::move (archive), @@ -1321,8 +1324,9 @@ elfctf_build_symtabs (objfile *objfile) if (ctf_archive_iter (per_objfile.archive.get (), build_ctf_archive_member, &iter_data) < 0) - error (_("ctf_archive_iter failed in input file %s: - %s"), - bfd_get_filename (abfd), ctf_errmsg (err)); + error (_("ctf_archive_iter failed in input file %ps: - %s"), + styled_string (file_name_style.style (), bfd_get_filename (abfd)), + ctf_errmsg (err)); objfile->qf.emplace_front (std::make_unique (std::move (iter_data.compunit_symtabs))); diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c index b403265a18d..8f3d52567ec 100644 --- a/gdb/dwarf2/dwz.c +++ b/gdb/dwarf2/dwz.c @@ -97,7 +97,8 @@ locate_dwz_sections (objfile *objfile, dwz_file &dwz_file) static void debug_sup_failure (const char *text, bfd *abfd) { - error (_("%s [in modules %s]"), text, bfd_get_filename (abfd)); + error (_("%s [in modules %ps]"), text, + styled_string (file_name_style.style (), bfd_get_filename (abfd))); } /* Look for the .debug_sup section and read it. If the section does @@ -390,9 +391,9 @@ dwz_file::read_dwz_file (dwarf2_per_objfile *per_objfile) } if (dwz_bfd == NULL) - error (_("could not find supplementary DWARF file (%s) for %s"), - filename.c_str (), - per_bfd->filename ()); + error (_("could not find supplementary DWARF file (%ps) for %ps"), + styled_string (file_name_style.style (), filename.c_str ()), + styled_string (file_name_style.style (), per_bfd->filename ())); dwz_file_up result (new dwz_file (std::move (dwz_bfd))); diff --git a/gdb/exec.c b/gdb/exec.c index b1b2d2d190d..873686e6286 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -463,10 +463,9 @@ exec_file_attach (const char *filename, int from_tty) current_program_space->set_exec_bfd (std::move (temp)); if (!current_program_space->exec_bfd ()) - { - error (_("\"%s\": could not open as an executable file: %s."), - scratch_pathname, bfd_errmsg (bfd_get_error ())); - } + error (_("\"%ps\": could not open as an executable file: %s."), + styled_string (file_name_style.style (), scratch_pathname), + bfd_errmsg (bfd_get_error ())); /* gdb_realpath_keepfile resolves symlinks on the local filesystem and so cannot be used for "target:" files. */ @@ -486,7 +485,8 @@ exec_file_attach (const char *filename, int from_tty) /* Make sure to close exec_bfd, or else "run" might try to use it. */ current_program_space->exec_close (); - error (_("\"%s\": not in executable format: %s"), scratch_pathname, + error (_("\"%ps\": not in executable format: %s"), + styled_string (file_name_style.style (), scratch_pathname), gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); } diff --git a/gdb/gcore.c b/gdb/gcore.c index 48e431ed8f9..ff429098b7e 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -37,6 +37,7 @@ #include "gdbsupport/byte-vector.h" #include "gdbsupport/scope-exit.h" #include "auxv.h" +#include "cli/cli-style.h" /* To generate sparse cores, we look at the data to write in chunks of this size when considering whether to skip the write. Only if we @@ -67,7 +68,8 @@ create_gcore_bfd (const char *filename) gdb_bfd_ref_ptr obfd (gdb_bfd_openw (filename, default_gcore_target ())); if (obfd == NULL) - error (_("Failed to open '%s' for output."), filename); + error (_("Failed to open '%ps' for output."), + styled_string (file_name_style.style (), filename)); bfd_set_format (obfd.get (), bfd_core); bfd_set_arch_mach (obfd.get (), default_gcore_arch (), 0); return obfd; @@ -101,8 +103,9 @@ write_gcore_file_1 (bfd *obfd) | SEC_READONLY | SEC_ALLOC); if (note_sec == NULL) - error (_("Failed to create 'note' section for corefile: %s"), - bfd_errmsg (bfd_get_error ())); + error (_("Failed to create 'note' section for corefile: %ps"), + styled_string (file_name_style.style (), + bfd_errmsg (bfd_get_error ()))); bfd_set_section_vma (note_sec, 0); bfd_set_section_alignment (note_sec, 0); diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 342957273cd..952875955ad 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -834,8 +834,10 @@ get_file_crc (bfd *abfd, unsigned long *file_crc_return) if (bfd_seek (abfd, 0, SEEK_SET) != 0) { - warning (_("Problem reading \"%s\" for CRC: %s"), - bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); + warning (_("Problem reading \"%ps\" for CRC: %s"), + styled_string (file_name_style.style (), + bfd_get_filename (abfd)), + bfd_errmsg (bfd_get_error ())); return 0; } @@ -847,8 +849,10 @@ get_file_crc (bfd *abfd, unsigned long *file_crc_return) count = bfd_read (buffer, sizeof (buffer), abfd); if (count == (bfd_size_type) -1) { - warning (_("Problem reading \"%s\" for CRC: %s"), - bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); + warning (_("Problem reading \"%ps\" for CRC: %s"), + styled_string (file_name_style.style (), + bfd_get_filename (abfd)), + bfd_errmsg (bfd_get_error ())); return 0; } if (count == 0) diff --git a/gdb/linespec.c b/gdb/linespec.c index 7624c92ab25..981bd5faa4f 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -45,6 +45,7 @@ #include #include "inferior.h" #include "gdbsupport/unordered_set.h" +#include "cli/cli-style.h" /* An enumeration of the various things a user might attempt to complete for a linespec location. */ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 1d0a4609a3a..218ead00136 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -63,6 +63,7 @@ #include "gdbsupport/scope-exit.h" #include "gdbsupport/gdb-sigmask.h" #include "gdbsupport/common-debug.h" +#include "cli/cli-style.h" /* This comment documents high-level logic of this file. @@ -4305,7 +4306,8 @@ linux_proc_pending_signals (int pid, sigset_t *pending, xsnprintf (fname, sizeof fname, "/proc/%d/status", pid); gdb_file_up procfile = gdb_fopen_cloexec (fname, "r"); if (procfile == NULL) - error (_("Could not open %s"), fname); + error (_("Could not open %ps"), + styled_string (file_name_style.style () ,fname)); while (fgets (buffer, PATH_MAX, procfile.get ()) != NULL) { diff --git a/gdb/record-full.c b/gdb/record-full.c index e0af376f3eb..942bf983792 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -45,6 +45,7 @@ #include "top.h" #include "valprint.h" #include "interps.h" +#include "cli/cli-style.h" #include @@ -2310,8 +2311,9 @@ bfdcore_read (bfd *obfd, asection *osec, void *buf, int len, int *offset) if (ret) *offset += len; else - error (_("Failed to read %d bytes from core file %s ('%s')."), - len, bfd_get_filename (obfd), + error (_("Failed to read %d bytes from core file %ps ('%s')."), + len, styled_string (file_name_style.style (), + bfd_get_filename (obfd)), bfd_errmsg (bfd_get_error ())); } @@ -2366,8 +2368,9 @@ record_full_restore (struct bfd &cbfd) /* Check the magic code. */ bfdcore_read (&cbfd, osec, &magic, sizeof (magic), &bfd_offset); if (magic != RECORD_FULL_FILE_MAGIC) - error (_("Version mismatch or file format error in core file %s."), - bfd_get_filename (&cbfd)); + error (_("Version mismatch or file format error in core file %ps."), + styled_string (file_name_style.style (), + bfd_get_filename (&cbfd))); if (record_debug) gdb_printf (gdb_stdlog, " Reading 4-byte magic cookie " @@ -2470,8 +2473,9 @@ record_full_restore (struct bfd &cbfd) break; default: - error (_("Bad entry type in core file %s."), - bfd_get_filename (&cbfd)); + error (_("Bad entry type in core file %ps."), + styled_string (file_name_style.style (), + bfd_get_filename (&cbfd))); break; } @@ -2516,8 +2520,9 @@ bfdcore_write (bfd *obfd, asection *osec, void *buf, int len, int *offset) if (ret) *offset += len; else - error (_("Failed to write %d bytes to core file %s ('%s')."), - len, bfd_get_filename (obfd), + error (_("Failed to write %d bytes to core file %ps ('%s')."), + len, styled_string (file_name_style.style (), + bfd_get_filename (obfd)), bfd_errmsg (bfd_get_error ())); } @@ -2601,8 +2606,8 @@ record_full_base_target::save_record (const char *recfilename) SEC_HAS_CONTENTS | SEC_READONLY); if (osec == NULL) - error (_("Failed to create 'precord' section for corefile %s: %s"), - recfilename, + error (_("Failed to create 'precord' section for corefile %ps: %s"), + styled_string (file_name_style.style (), recfilename), bfd_errmsg (bfd_get_error ())); bfd_set_section_size (osec, save_size); bfd_set_section_vma (osec, 0); diff --git a/gdb/remote.c b/gdb/remote.c index 23ef6145620..0317119f292 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -13998,7 +13998,8 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file, if (bytes == 0) { if (ferror (file.get ())) - error (_("Error reading %s."), local_file); + error (_("Error reading %ps."), + styled_string (file_name_style.style (), local_file)); else { /* EOF. Unless there is something still in the diff --git a/gdb/skip.c b/gdb/skip.c index eb47cee9e34..917b084860d 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -1373,8 +1373,9 @@ save_skip_command (const char *filename, int from_tty) gdb::unique_xmalloc_ptr expanded_filename (tilde_expand (filename)); stdio_file fp; if (!fp.open (expanded_filename.get (), "w")) - error (_("Unable to open file '%s' for saving (%s)"), - expanded_filename.get (), safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving (%s)"), + styled_string (file_name_style.style (), expanded_filename.get ()), + safe_strerror (errno)); for (const auto &entry : skiplist_entries) entry.print_recreate (&fp); diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index d4367973ad5..4f029529106 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -23,6 +23,7 @@ #include "symtab.h" #include "xcoffread.h" #include "observable.h" +#include "cli/cli-style.h" /* solib_ops for AIX systems. */ @@ -540,8 +541,9 @@ aix_solib_ops::bfd_open (const char *pathname) const found_file)); if (archive_bfd == NULL) { - warning (_("Could not open `%s' as an executable file: %s"), - filename.c_str (), bfd_errmsg (bfd_get_error ())); + warning (_("Could not open `%ps' as an executable file: %s"), + styled_string (file_name_style.style (), filename.c_str ()), + bfd_errmsg (bfd_get_error ())); return NULL; } @@ -550,8 +552,9 @@ aix_solib_ops::bfd_open (const char *pathname) const if (! bfd_check_format (archive_bfd.get (), bfd_archive)) { - warning (_("\"%s\": not in executable format: %s."), - filename.c_str (), bfd_errmsg (bfd_get_error ())); + warning (_("\"%ps\": not in executable format: %s."), + styled_string (file_name_style.style (), filename.c_str ()), + bfd_errmsg (bfd_get_error ())); return NULL; } @@ -589,8 +592,9 @@ aix_solib_ops::bfd_open (const char *pathname) const if (! bfd_check_format (object_bfd.get (), bfd_object)) { - warning (_("%s(%s): not in object format: %s."), - filename.c_str (), member_name.c_str (), + warning (_("%ps(%s): not in object format: %s."), + styled_string (file_name_style.style (), filename.c_str ()), + member_name.c_str (), bfd_errmsg (bfd_get_error ())); return NULL; } diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 3412f662910..6e2535ca427 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -26,6 +26,7 @@ #include "inferior.h" #include "regcache.h" #include "gdb_bfd.h" +#include "cli/cli-style.h" #include "solib.h" #include "solib-darwin.h" @@ -623,8 +624,10 @@ darwin_solib_ops::bfd_open (const char *pathname) const (abfd.get (), bfd_object, gdbarch_bfd_arch_info (current_inferior ()->arch ()))); if (res == NULL) - error (_("`%s': not a shared-library: %s"), - bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ())); + error (_("`%ps': not a shared-library: %s"), + styled_string (file_name_style.style (), + bfd_get_filename (abfd.get ())), + bfd_errmsg (bfd_get_error ())); /* The current filename for fat-binary BFDs is a name generated by BFD, usually a string containing the name of the architecture. diff --git a/gdb/solib.c b/gdb/solib.c index 2cf9e17738d..782b844aa2f 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -387,7 +387,8 @@ solib_bfd_fopen (const char *pathname, int fd) gdb_bfd_ref_ptr abfd (gdb_bfd_open (pathname, gnutarget, fd)); if (abfd == NULL) - error (_("Could not open `%s' as an executable file: %s"), pathname, + error (_("Could not open `%ps' as an executable file: %s"), + styled_string (file_name_style.style (), pathname), bfd_errmsg (bfd_get_error ())); return abfd; @@ -419,15 +420,18 @@ solib_bfd_open (const char *pathname) /* Check bfd format. */ if (!bfd_check_format (abfd.get (), bfd_object)) - error (_("`%s': not in executable format: %s"), - bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ())); + error (_("`%ps': not in executable format: %s"), + styled_string (file_name_style.style (), + bfd_get_filename (abfd.get ())), + bfd_errmsg (bfd_get_error ())); /* Check bfd arch. */ b = gdbarch_bfd_arch_info (current_inferior ()->arch ()); if (!b->compatible (b, bfd_get_arch_info (abfd.get ()))) - error (_("`%s': Shared library architecture %s is not compatible " + error (_("`%ps': Shared library architecture %s is not compatible " "with target architecture %s."), - bfd_get_filename (abfd.get ()), + styled_string (file_name_style.style (), + bfd_get_filename (abfd.get ())), bfd_get_arch_info (abfd.get ())->printable_name, b->printable_name); return abfd; diff --git a/gdb/symfile.c b/gdb/symfile.c index e3aa81fbc0c..d0ea9506c63 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1699,11 +1699,13 @@ symfile_bfd_open (const char *name) gdb_bfd_ref_ptr sym_bfd (gdb_bfd_open (name, gnutarget, desc)); if (sym_bfd == NULL) - error (_("`%s': can't open to read symbols: %s."), name, + error (_("`%ps': can't open to read symbols: %s."), + styled_string (file_name_style.style (), name), bfd_errmsg (bfd_get_error ())); if (!bfd_check_format (sym_bfd.get (), bfd_object)) - error (_("`%s': can't read symbols: %s."), name, + error (_("`%ps': can't read symbols: %s."), + styled_string (file_name_style.style (), name), bfd_errmsg (bfd_get_error ())); return sym_bfd; @@ -1766,8 +1768,9 @@ find_sym_fns (bfd *abfd) iter != symtab_fns.end ()) return iter->second; - error (_("Object file %s could not be read. Symbol format `%s' unknown."), - abfd->filename, bfd_get_target (abfd)); + error (_("Object file %ps could not be read. Symbol format `%s' unknown."), + styled_string (file_name_style.style (), abfd->filename), + bfd_get_target (abfd)); } @@ -2013,10 +2016,9 @@ generic_load (const char *args, int from_tty) perror_with_name (filename.get ()); if (!bfd_check_format (loadfile_bfd.get (), bfd_object)) - { - error (_("\"%s\" is not an object file: %s"), filename.get (), - bfd_errmsg (bfd_get_error ())); - } + error (_("\"%ps\" is not an object file: %s"), + styled_string (file_name_style.style (), filename.get ()), + bfd_errmsg (bfd_get_error ())); for (asection *asec : gdb_bfd_sections (loadfile_bfd)) total_progress.total_size += bfd_section_size (asec); @@ -2436,8 +2438,9 @@ remove_symbol_file_command (const char *args, int from_tty) error (_("No symbol file found")); if (from_tty - && !query (_("Remove symbol table from file \"%s\"? "), - objfile_name (objf))) + && !query (_("Remove symbol table from file \"%ps\"? "), + styled_string (file_name_style.style (), + objfile_name (objf)))) error (_("Not confirmed.")); objf->unlink (); @@ -2551,14 +2554,17 @@ reread_symbols (int from_tty) gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget)); objfile.obfd = std::move (temp); if (objfile.obfd == NULL) - error (_("Can't open %s to read symbols."), obfd_filename); + error (_("Can't open %ps to read symbols."), + styled_string (file_name_style.style (), obfd_filename)); } std::string original_name = objfile.original_name; /* bfd_openr sets cacheable to true, which is what we want. */ if (!bfd_check_format (objfile.obfd.get (), bfd_object)) - error (_("Can't read symbols from %s: %s."), objfile_name (&objfile), + error (_("Can't read symbols from %ps: %s."), + styled_string (file_name_style.style (), + objfile_name (&objfile)), bfd_errmsg (bfd_get_error ())); objfile.compunit_symtabs.clear (); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index a6dbb3b0603..b586f8fdb00 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -499,7 +499,8 @@ maintenance_print_symbols (const char *args, int from_tty) } if (source_arg != NULL && !found) - error (_("No symtab for source file: %s"), source_arg); + error (_("No symtab for source file: %ps"), + styled_string (file_name_style.style (), source_arg)); } } diff --git a/gdb/target.c b/gdb/target.c index 60c04b04b01..c7a6a318c8f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1314,39 +1314,49 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset, break; case TLS_LOAD_MODULE_NOT_FOUND_ERROR: if (objfile_is_library) - error (_("Cannot find shared library `%s' in dynamic" - " linker's load module list"), objfile_name (objfile)); + error (_("Cannot find shared library `%ps' in dynamic" + " linker's load module list"), + styled_string (file_name_style.style (), + objfile_name (objfile))); else - error (_("Cannot find executable file `%s' in dynamic" - " linker's load module list"), objfile_name (objfile)); + error (_("Cannot find executable file `%ps' in dynamic" + " linker's load module list"), + styled_string (file_name_style.style (), + objfile_name (objfile))); break; case TLS_NOT_ALLOCATED_YET_ERROR: if (objfile_is_library) error (_("The inferior has not yet allocated storage for" " thread-local variables in\n" - "the shared library `%s'\n" + "the shared library `%ps'\n" "for %s"), - objfile_name (objfile), + styled_string (file_name_style.style (), + objfile_name (objfile)), target_pid_to_str (ptid).c_str ()); else error (_("The inferior has not yet allocated storage for" " thread-local variables in\n" - "the executable `%s'\n" + "the executable `%ps'\n" "for %s"), - objfile_name (objfile), + styled_string (file_name_style.style (), + objfile_name (objfile)), target_pid_to_str (ptid).c_str ()); break; case TLS_GENERIC_ERROR: if (objfile_is_library) error (_("Cannot find thread-local storage for %s, " - "shared library %s:\n%s"), + "shared library %ps:\n%s"), target_pid_to_str (ptid).c_str (), - objfile_name (objfile), ex.what ()); + styled_string (file_name_style.style (), + objfile_name (objfile)), + ex.what ()); else error (_("Cannot find thread-local storage for %s, " - "executable file %s:\n%s"), + "executable file %ps:\n%s"), target_pid_to_str (ptid).c_str (), - objfile_name (objfile), ex.what ()); + styled_string (file_name_style.style (), + objfile_name (objfile)), + ex.what ()); break; default: throw; diff --git a/gdb/tracectf.c b/gdb/tracectf.c index aff2da55d66..9246022b517 100644 --- a/gdb/tracectf.c +++ b/gdb/tracectf.c @@ -31,6 +31,7 @@ #include #include "gdbsupport/filestuff.h" #include "gdbarch.h" +#include "cli/cli-style.h" /* GDB saves trace buffers and other information (such as trace status) got from the remote target into Common Trace Format (CTF). @@ -317,8 +318,9 @@ ctf_start (struct trace_file_writer *self, const char *dirname) /* Create DIRNAME. */ if (mkdir (dirname, hmode) && errno != EEXIST) - error (_("Unable to open directory '%s' for saving trace data (%s)"), - dirname, safe_strerror (errno)); + error (_("Unable to open directory '%ps' for saving trace data (%s)"), + styled_string (file_name_style.style (), dirname), + safe_strerror (errno)); memset (&writer->tcs, '\0', sizeof (writer->tcs)); @@ -327,8 +329,9 @@ ctf_start (struct trace_file_writer *self, const char *dirname) writer->tcs.metadata_fd = gdb_fopen_cloexec (file_name.c_str (), "w").release (); if (writer->tcs.metadata_fd == NULL) - error (_("Unable to open file '%s' for saving trace data (%s)"), - file_name.c_str (), safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving trace data (%s)"), + styled_string (file_name_style.style (), file_name.c_str ()), + safe_strerror (errno)); ctf_save_metadata_header (&writer->tcs); @@ -336,8 +339,9 @@ ctf_start (struct trace_file_writer *self, const char *dirname) writer->tcs.datastream_fd = gdb_fopen_cloexec (file_name.c_str (), "w").release (); if (writer->tcs.datastream_fd == NULL) - error (_("Unable to open file '%s' for saving trace data (%s)"), - file_name.c_str (), safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving trace data (%s)"), + styled_string (file_name_style.style (), file_name.c_str ()), + safe_strerror (errno)); } /* This is the implementation of trace_file_write_ops method diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index a6f5ae16b91..289e00ff531 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -32,6 +32,7 @@ #include "target-descriptions.h" #include "gdbsupport/pathstuff.h" #include +#include "cli/cli-style.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 @@ -123,8 +124,9 @@ tfile_start (struct trace_file_writer *self, const char *filename) writer->pathname = gdb_rl_tilde_expand (filename).release (); writer->fp = gdb_fopen_cloexec (writer->pathname, "wb").release (); if (writer->fp == NULL) - error (_("Unable to open file '%s' for saving trace data (%s)"), - writer->pathname, safe_strerror (errno)); + error (_("Unable to open file '%ps' for saving trace data (%s)"), + styled_string (file_name_style.style (), writer->pathname), + safe_strerror (errno)); } /* This is the implementation of trace_file_write_ops method diff --git a/gdb/utils.c b/gdb/utils.c index b073bb9fdf3..f5f19301460 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3727,7 +3727,9 @@ extract_single_filename_arg (const char *args) std::string filename = extract_string_maybe_quoted (&args); args = skip_spaces (args); if (*args != '\0') - error (_("Junk after filename \"%s\": %s"), filename.c_str (), args); + error (_("Junk after filename \"%ps\": %s"), + styled_string (file_name_style.style (), filename.c_str ()), + args); if (!filename.empty ()) filename = gdb_tilde_expand (filename.c_str ()); return filename; diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index fb223416240..73662c47c3d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -35,6 +35,7 @@ #include "complaints.h" #include "dwarf2/sect-names.h" #include "dwarf2/public.h" +#include "cli/cli-style.h" struct xcoff_symfile_info { @@ -134,8 +135,9 @@ xcoff_find_toc_offset (objfile *objfile) /* Seek to symbol table location. */ if (bfd_seek (abfd, symtab_offset, SEEK_SET) < 0) - error (_("Error reading symbols from %s: %s"), - objfile_name (objfile), bfd_errmsg (bfd_get_error ())); + error (_("Error reading symbols from %ps: %s"), + styled_string (file_name_style.style (), objfile_name (objfile)), + bfd_errmsg (bfd_get_error ())); unsigned int num_symbols = bfd_get_symcount (abfd); size_t size = coff_data (abfd)->local_symesz * num_symbols; diff --git a/gdb/xml-support.c b/gdb/xml-support.c index a538c16f926..d806b53c9fa 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -23,6 +23,8 @@ #include "gdbsupport/filestuff.h" #include #include +#include "cli/cli-style.h" +#include "ui-out.h" /* Debugging flag. */ static bool debug_xml; @@ -990,7 +992,8 @@ xml_fetch_content_from_file (const char *filename, const char *dirname) if (fread (text.data (), 1, len, file.get ()) != len || ferror (file.get ())) { - warning (_("Read error from \"%s\""), filename); + warning (_("Read error from \"%ps\""), + styled_string (file_name_style.style (), filename)); return {}; } -- 2.49.0