From patchwork Fri Sep 27 21:25:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34701 Received: (qmail 106707 invoked by alias); 27 Sep 2019 21:25:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 106466 invoked by uid 89); 27 Sep 2019 21:25:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: gateway36.websitewelcome.com Received: from gateway36.websitewelcome.com (HELO gateway36.websitewelcome.com) (192.185.197.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 27 Sep 2019 21:25:27 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 350CE40124082 for ; Fri, 27 Sep 2019 15:31:44 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id DxjxihcyiBnGaDxjxisxmm; Fri, 27 Sep 2019 16:25:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=U6d7iyRw3Mss4BA7vJyWD/rs3woqQLrUZQC+9OVFypA=; b=q+t9ixzhJL/kcXF3jg2gb6t4HD CrDAjXbp/9r5iHKeqw1ckyTr0/rUGSLMrUvUJwi9dHskZQW+DPl5Ia30QQrazQgGctKvGnNBnd164 bky1a/2LHi3RlZLShWMzrl8LM; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:34758 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iDxjx-002PvY-Iu; Fri, 27 Sep 2019 16:25:25 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 7/8] Use styled_string in more places Date: Fri, 27 Sep 2019 15:25:19 -0600 Message-Id: <20190927212520.20073-8-tom@tromey.com> In-Reply-To: <20190927212520.20073-1-tom@tromey.com> References: <20190927212520.20073-1-tom@tromey.com> This adds more uses of styled_string, changing gdb to style some output that was previously left unstyled. gdb/ChangeLog 2019-09-27 Tom Tromey * stack.c (print_frame, info_frame_command_core): Use styled_string. * linux-thread-db.c (try_thread_db_load_1) (try_thread_db_load_from_pdir_1): Use styled_string. * auto-load.c (file_is_auto_load_safe, execute_script_contents) (auto_load_section_scripts, info_auto_load_local_gdbinit) (maybe_print_unsupported_script_warning) (maybe_print_script_not_found_warning): Use styled_string. * ada-lang.c (user_select_syms): Use styled_string. --- gdb/ChangeLog | 12 ++++++++++++ gdb/ada-lang.c | 8 +++++--- gdb/auto-load.c | 40 ++++++++++++++++++++++++++-------------- gdb/linux-thread-db.c | 9 ++++++--- gdb/stack.c | 9 ++++++--- 5 files changed, 55 insertions(+), 23 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 846c9b4dec5..48a400daa7d 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3881,9 +3881,11 @@ See set/show multiple-symbol.")); printf_filtered (_(" at %p[%p]:%d\n"), metadata_style.style ().ptr (), nullptr, sal.line); else - printf_filtered (_(" at %s:%d\n"), - symtab_to_filename_for_display (sal.symtab), - sal.line); + printf_filtered + (_(" at %ps:%d\n"), + styled_string (file_name_style.style (), + symtab_to_filename_for_display (sal.symtab)), + sal.line); continue; } else diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 136d53ffe13..0864ad38a76 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -41,6 +41,7 @@ #include "gdb/section-scripts.h" #include #include "gdbsupport/pathstuff.h" +#include "cli/cli-style.h" /* The section to look in for auto-loaded scripts (in file formats that support sections). @@ -490,9 +491,10 @@ file_is_auto_load_safe (const char *filename, const char *debug_fmt, ...) if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real)) return 1; - warning (_("File \"%s\" auto-loading has been declined by your " + warning (_("File \"%ps\" auto-loading has been declined by your " "`auto-load safe-path' set to \"%s\"."), - filename_real.get (), auto_load_safe_path); + styled_string (file_name_style.style (), filename_real.get ()), + auto_load_safe_path); if (!advice_printed) { @@ -989,8 +991,10 @@ execute_script_contents (struct auto_load_pspace_info *pspace_info, /* We don't throw an error, the program is still debuggable. */ warning (_("\ Missing/bad script name in entry at offset %u in section %s\n\ -of file %s."), - offset, section_name, objfile_name (objfile)); +of file %ps."), + offset, section_name, + styled_string (file_name_style.style (), + objfile_name (objfile))); return; } script_text = newline + 1; @@ -1120,8 +1124,10 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name) return; if (!bfd_get_full_section_contents (abfd, scripts_sect, &data)) - warning (_("Couldn't read %s section of %s"), - section_name, bfd_get_filename (abfd)); + warning (_("Couldn't read %s section of %ps"), + section_name, + styled_string (file_name_style.style (), + bfd_get_filename (abfd))); else { gdb::unique_xmalloc_ptr data_holder (data); @@ -1349,11 +1355,13 @@ info_auto_load_local_gdbinit (const char *args, int from_tty) if (auto_load_local_gdbinit_pathname == NULL) printf_filtered (_("Local .gdbinit file was not found.\n")); else if (auto_load_local_gdbinit_loaded) - printf_filtered (_("Local .gdbinit file \"%s\" has been loaded.\n"), - auto_load_local_gdbinit_pathname); + printf_filtered (_("Local .gdbinit file \"%ps\" has been loaded.\n"), + styled_string (file_name_style.style (), + auto_load_local_gdbinit_pathname)); else - printf_filtered (_("Local .gdbinit file \"%s\" has not been loaded.\n"), - auto_load_local_gdbinit_pathname); + printf_filtered (_("Local .gdbinit file \"%ps\" has not been loaded.\n"), + styled_string (file_name_style.style (), + auto_load_local_gdbinit_pathname)); } /* Print an "unsupported script" warning if it has not already been printed. @@ -1370,9 +1378,11 @@ maybe_print_unsupported_script_warning { warning (_("\ Unsupported auto-load script at offset %u in section %s\n\ -of file %s.\n\ +of file %ps.\n\ Use `info auto-load %s-scripts [REGEXP]' to list them."), - offset, section_name, objfile_name (objfile), + offset, section_name, + styled_string (file_name_style.style (), + objfile_name (objfile)), ext_lang_name (language)); pspace_info->unsupported_script_warning_printed = true; } @@ -1392,9 +1402,11 @@ maybe_print_script_not_found_warning { warning (_("\ Missing auto-load script at offset %u in section %s\n\ -of file %s.\n\ +of file %ps.\n\ Use `info auto-load %s-scripts [REGEXP]' to list them."), - offset, section_name, objfile_name (objfile), + offset, section_name, + styled_string (file_name_style.style (), + objfile_name (objfile)), ext_lang_name (language)); pspace_info->script_not_found_warning_printed = true; } diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index 100434e2c9d..b7c4f245b95 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -48,6 +48,7 @@ #include #include "gdbsupport/pathstuff.h" #include "valprint.h" +#include "cli/cli-style.h" /* GNU/Linux libthread_db support. @@ -933,8 +934,9 @@ try_thread_db_load_1 (struct thread_db_info *info) enabled. User visible output should not depend on debug settings. */ file = *libthread_db_search_path != '\0' ? gdb_stdout : gdb_stdlog; - fprintf_unfiltered (file, _("Using host libthread_db library \"%s\".\n"), - library); + fprintf_unfiltered (file, + _("Using host libthread_db library \"%ps\".\n"), + styled_string (file_name_style.style (), library)); } /* The thread library was detected. Activate the thread_db target @@ -1028,7 +1030,8 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir) if (obj_name[0] != '/') { warning (_("Expected absolute pathname for libpthread in the" - " inferior, but got %s."), obj_name); + " inferior, but got %ps."), + styled_string (file_name_style.style (), obj_name)); return false; } diff --git a/gdb/stack.c b/gdb/stack.c index cb07e28b671..c7c67fc7d5c 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1393,7 +1393,7 @@ print_frame (const frame_print_options &fp_opts, annotate_frame_where (); uiout->wrap_hint (" "); uiout->text (" from "); - uiout->field_string ("from", lib); + uiout->field_string ("from", lib, file_name_style.style ()); } } if (uiout->is_mi_like_p ()) @@ -1524,8 +1524,11 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) } wrap_here (" "); if (sal.symtab) - printf_filtered (" (%s:%d)", symtab_to_filename_for_display (sal.symtab), - sal.line); + printf_filtered + (" (%ps:%d)", + styled_string (file_name_style.style (), + symtab_to_filename_for_display (sal.symtab)), + sal.line); puts_filtered ("; "); wrap_here (" "); printf_filtered ("saved %s = ", pc_regname);