[binutils-gdb] Style history variable output
Tom Tromey
tromey@sourceware.org
Sun Oct 22 15:04:53 GMT 2023
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2c04ee000796100890bd176eeb2412f722b7e3f
commit e2c04ee000796100890bd176eeb2412f722b7e3f
Author: Tom Tromey <tom@tromey.com>
Date: Mon Jun 12 17:10:14 2023 -0600
Style history variable output
When printing a value, I think the history reference -- the "$1" in
the output -- should be styled using the "variable" style. This patch
implements this.
Diff:
---
gdb/printcmd.c | 4 +++-
gdb/testsuite/gdb.base/style.exp | 3 ++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 5e9c8a5b222..b9b6a3b8648 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1254,7 +1254,9 @@ print_value (value *val, const value_print_options &opts)
annotate_value_history_begin (histindex, val->type ());
- gdb_printf ("$%d = ", histindex);
+ std::string idx = string_printf ("$%d", histindex);
+ gdb_printf ("%ps = ", styled_string (variable_name_style.style (),
+ idx.c_str ()));
annotate_value_history_value ();
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 7ee1b44177f..46d0d9ebe8c 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -206,8 +206,9 @@ proc run_style_tests { } {
set sfield [limited_style string_field variable]
set efield [limited_style e_field variable]
set evalue [limited_style VALUE_TWO variable]
+ set lhs [limited_style "\\\$$decimal" variable]
gdb_test "print struct_value" \
- "\{$ifield = 23,.*$sfield = .*,.*$efield = $evalue.*"
+ "$lhs = \{$ifield = 23,.*$sfield = .*,.*$efield = $evalue.*"
set ffield [limited_style field variable]
set cstart [string_to_regexp "/* XXX "]
More information about the Gdb-cvs
mailing list