public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Add file name styling to "info sharedlibrary"
@ 2019-05-14 13:49 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-05-14 13:49 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7bd7fba34ae1f892acf1e13ac86fca55b68026d

commit e7bd7fba34ae1f892acf1e13ac86fca55b68026d
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon May 13 09:35:19 2019 -0600

    Add file name styling to "info sharedlibrary"
    
    This changes "info sharedlibrary" to add styling to the file name.
    
    Tested on x86-64 Fedora 29.
    
    gdb/ChangeLog
    2019-05-14  Tom Tromey  <tromey@adacore.com>
    
    	* solib.c (info_sharedlibrary_command): Style the file name.
    
    gdb/testsuite/ChangeLog
    2019-05-14  Tom Tromey  <tromey@adacore.com>
    
    	* gdb.base/info-shared.exp (check_info_shared): Add "info shared"
    	styling test.

Diff:
---
 gdb/ChangeLog                          |  4 ++++
 gdb/solib.c                            |  2 +-
 gdb/testsuite/ChangeLog                |  5 +++++
 gdb/testsuite/gdb.base/info-shared.exp | 24 ++++++++++++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 44646f5..095a6c2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2019-05-14  Tom Tromey  <tromey@adacore.com>
+
+	* solib.c (info_sharedlibrary_command): Style the file name.
+
 2019-05-14  Alan Hayward  <alan.hayward@arm.com>
 
 	* aarch64-tdep.c (aarch64_vnh_type): Add half view.
diff --git a/gdb/solib.c b/gdb/solib.c
index 25555af..e0b1a92 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1104,7 +1104,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
 	else
 	  uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No");
 
-	uiout->field_string ("name", so->so_name);
+	uiout->field_string ("name", so->so_name, ui_out_style_kind::FILE);
 
 	uiout->text ("\n");
       }
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d8847bc..071c638 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-14  Tom Tromey  <tromey@adacore.com>
+
+	* gdb.base/info-shared.exp (check_info_shared): Add "info shared"
+	styling test.
+
 2019-05-14  Tom de Vries  <tdevries@suse.de>
 
 	* gdb.dwarf2/dw2-skip-prologue.S (.debug_loc): Fix base address
diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp
index eb5ee95..e1314bf 100644
--- a/gdb/testsuite/gdb.base/info-shared.exp
+++ b/gdb/testsuite/gdb.base/info-shared.exp
@@ -144,3 +144,27 @@ check_info_shared "info sharedlibrary #7" 0 1
 # Run to the last stop and check that both libraries are gone.
 gdb_continue_to_breakpoint "library unload #2" "\\.?stop .*"
 check_info_shared "info sharedlibrary #8" 0 0
+
+with_test_prefix styled {
+    save_vars { env(TERM) } {
+	# We need an ANSI-capable terminal to get the output.
+	setenv TERM ansi
+
+	clean_restart $testfile
+
+	gdb_test_no_output "set style enabled off"
+	if {![runto_main]} {
+	    return 0
+	}
+	gdb_breakpoint "stop"
+	gdb_continue_to_breakpoint "library load #1" "\\.?stop .*"
+
+	# Simple test for "info sharedlibrary" styling.  Look for styled
+	# addresses and file name.
+	set addr "\033\\\[34m${hex}\033\\\[m"
+	set sofile "\033\\\[32m\[^\033\]+\033\\\[m"
+	gdb_test_no_output "set style enabled on"
+	gdb_test "info sharedlibrary" \
+	    "$addr\[ \t\]+$addr.*$sofile\r\n.*"
+    }
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-14 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 13:49 [binutils-gdb] Add file name styling to "info sharedlibrary" Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).