mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-21 01:12:32 +08:00
gdb: more file name styling
While looking at the recent line number styling commit I noticed a few places where we could add more file name styling. So lets do that. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
parent
042f14505e
commit
bcb92f7ba7
@ -3698,9 +3698,11 @@ See set/show multiple-symbol."));
|
||||
gdb_printf ("[%d] ", i + first_choice);
|
||||
ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
|
||||
&type_print_raw_options);
|
||||
gdb_printf (_(" at %s:%d\n"),
|
||||
symtab_to_filename_for_display (symtab),
|
||||
syms[i].symbol->line ());
|
||||
gdb_printf (_(" at %ps:%ps\n"),
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (symtab)),
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (syms[i].symbol->line ())));
|
||||
}
|
||||
else if (is_enumeral
|
||||
&& syms[i].symbol->type ()->name () != NULL)
|
||||
@ -3719,9 +3721,10 @@ See set/show multiple-symbol."));
|
||||
|
||||
if (symtab != NULL)
|
||||
gdb_printf (is_enumeral
|
||||
? _(" in %s (enumeral)\n")
|
||||
: _(" at %s:?\n"),
|
||||
symtab_to_filename_for_display (symtab));
|
||||
? _(" in %ps (enumeral)\n")
|
||||
: _(" at %ps:?\n"),
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (symtab)));
|
||||
else
|
||||
gdb_printf (is_enumeral
|
||||
? _(" (enumeral)\n")
|
||||
|
@ -1016,16 +1016,23 @@ edit_command (const char *arg, int from_tty)
|
||||
gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
|
||||
sym = find_pc_function (sal.pc);
|
||||
if (sym)
|
||||
gdb_printf ("%s is in %s (%s:%d).\n",
|
||||
paddress (gdbarch, sal.pc),
|
||||
sym->print_name (),
|
||||
symtab_to_filename_for_display (sal.symtab),
|
||||
sal.line);
|
||||
gdb_printf ("%ps is in %ps (%ps:%ps).\n",
|
||||
styled_string (address_style.style (),
|
||||
paddress (gdbarch, sal.pc)),
|
||||
styled_string (function_name_style.style (),
|
||||
sym->print_name ()),
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (sal.symtab)),
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (sal.line)));
|
||||
else
|
||||
gdb_printf ("%s is at %s:%d.\n",
|
||||
paddress (gdbarch, sal.pc),
|
||||
symtab_to_filename_for_display (sal.symtab),
|
||||
sal.line);
|
||||
gdb_printf ("%ps is at %ps:%ps.\n",
|
||||
styled_string (address_style.style (),
|
||||
paddress (gdbarch, sal.pc)),
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (sal.symtab)),
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (sal.line)));
|
||||
}
|
||||
|
||||
/* If what was given does not imply a symtab, it must be an
|
||||
|
@ -899,7 +899,10 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
|
||||
output includes the source specs for each line. */
|
||||
if (sal.symtab != NULL)
|
||||
{
|
||||
uiout->text (symtab_to_filename_for_display (sal.symtab));
|
||||
auto filename = symtab_to_filename_for_display (sal.symtab);
|
||||
uiout->message ("%ps",
|
||||
styled_string (file_name_style.style (),
|
||||
filename));
|
||||
}
|
||||
else
|
||||
uiout->text ("unknown");
|
||||
|
19
gdb/source.c
19
gdb/source.c
@ -1386,7 +1386,9 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
|
||||
last_line_listed = loc->line ();
|
||||
if (flags & PRINT_SOURCE_LINES_FILENAME)
|
||||
{
|
||||
uiout->text (symtab_to_filename_for_display (s));
|
||||
uiout->message ("%ps",
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (s)));
|
||||
uiout->text (":");
|
||||
}
|
||||
|
||||
@ -1553,10 +1555,11 @@ info_line_command (const char *arg, int from_tty)
|
||||
|
||||
if (start_pc == end_pc)
|
||||
{
|
||||
gdb_printf ("Line %ps of \"%s\"",
|
||||
gdb_printf ("Line %ps of \"%ps\"",
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (sal.line)),
|
||||
symtab_to_filename_for_display (sal.symtab));
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (sal.symtab)));
|
||||
gdb_stdout->wrap_here (2);
|
||||
gdb_printf (" is at address ");
|
||||
print_address (gdbarch, start_pc, gdb_stdout);
|
||||
@ -1565,10 +1568,11 @@ info_line_command (const char *arg, int from_tty)
|
||||
}
|
||||
else
|
||||
{
|
||||
gdb_printf ("Line %ps of \"%s\"",
|
||||
gdb_printf ("Line %ps of \"%ps\"",
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (sal.line)),
|
||||
symtab_to_filename_for_display (sal.symtab));
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (sal.symtab)));
|
||||
gdb_stdout->wrap_here (2);
|
||||
gdb_printf (" starts at address ");
|
||||
print_address (gdbarch, start_pc, gdb_stdout);
|
||||
@ -1593,10 +1597,11 @@ info_line_command (const char *arg, int from_tty)
|
||||
/* Is there any case in which we get here, and have an address
|
||||
which the user would want to see? If we have debugging symbols
|
||||
and no line numbers? */
|
||||
gdb_printf (_("Line number %ps is out of range for \"%s\".\n"),
|
||||
gdb_printf (_("Line number %ps is out of range for \"%ps\".\n"),
|
||||
styled_string (line_number_style.style (),
|
||||
pulongest (sal.line)),
|
||||
symtab_to_filename_for_display (sal.symtab));
|
||||
styled_string (file_name_style.style (),
|
||||
symtab_to_filename_for_display (sal.symtab)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user