diff options
author | Tom Tromey <tom@tromey.com> | 2024-09-14 15:07:17 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-09-30 13:23:35 -0600 |
commit | 887ae0cf2be5cb10d68b14f16df8faf666f4e43b (patch) | |
tree | f7c92c61df329414d9e57a31c9f034750992e7ec /gdb/cli | |
parent | 7ecf0250f7f0868f3b828ffadd47d0e5f2dbd875 (diff) | |
download | binutils-887ae0cf2be5cb10d68b14f16df8faf666f4e43b.zip binutils-887ae0cf2be5cb10d68b14f16df8faf666f4e43b.tar.gz binutils-887ae0cf2be5cb10d68b14f16df8faf666f4e43b.tar.bz2 |
Add line-number styling
This patch adds separate styling for line numbers. That is, whenever
gdb prints a source line number, it uses this style.
v2 includes a change to ensure that %ps works in query.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-by: Keith Seitz <keiths@redhat.com>
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-cmds.c | 6 | ||||
-rw-r--r-- | gdb/cli/cli-style.c | 12 | ||||
-rw-r--r-- | gdb/cli/cli-style.h | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index a0e28eb..2e57b0d 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2116,9 +2116,11 @@ print_sal_location (const symtab_and_line &sal) const char *sym_name = NULL; if (sal.symbol != NULL) sym_name = sal.symbol->print_name (); - gdb_printf (_("file: \"%s\", line number: %d, symbol: \"%s\"\n"), + gdb_printf (_("file: \"%s\", line number: %ps, symbol: \"%s\"\n"), symtab_to_filename_for_display (sal.symtab), - sal.line, sym_name != NULL ? sym_name : "???"); + styled_string (line_number_style.style (), + pulongest (sal.line)), + sym_name != NULL ? sym_name : "???"); } /* Print a list of files and line numbers which a user may choose from diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c index 5928998..36a8bd9 100644 --- a/gdb/cli/cli-style.c +++ b/gdb/cli/cli-style.c @@ -126,6 +126,10 @@ cli_style_option disasm_comment_style ("comment", ui_file_style::WHITE, /* See cli-style.h. */ +cli_style_option line_number_style ("line-number", ui_file_style::DIM); + +/* See cli-style.h. */ + cli_style_option::cli_style_option (const char *name, ui_file_style::basic_color fg, ui_file_style::intensity intensity) @@ -529,6 +533,14 @@ then this style has no effect."), &style_disasm_show_list, false); + line_number_style.add_setshow_commands (no_class, _("\ +Line number display styling.\n\ +Configure colors and display intensity for line numbers\n\ +The \"line-number\" style is used when GDB displays line numbers\n\ +coming from your source code."), + &style_set_list, &style_show_list, + false); + /* Setup 'disassembler address' style and 'disassembler symbol' style, these are aliases for 'address' and 'function' styles respectively. */ add_alias_cmd ("address", address_prefix_cmds.set, no_class, 0, diff --git a/gdb/cli/cli-style.h b/gdb/cli/cli-style.h index 1663b4e..5052b86 100644 --- a/gdb/cli/cli-style.h +++ b/gdb/cli/cli-style.h @@ -145,6 +145,9 @@ extern cli_style_option tui_active_border_style; /* The style to use for the GDB version string. */ extern cli_style_option version_style; +/* The style for a line number. */ +extern cli_style_option line_number_style; + /* True if source styling is enabled. */ extern bool source_styling; |