aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-10-19 16:22:35 -0600
committerTom Tromey <tom@tromey.com>2018-12-28 12:49:52 -0700
commit35fb8261b95c07e548a0b03f60b6c2cebf83caf8 (patch)
treebc743f84964d5cbb252578826288456108365bce /gdb/printcmd.c
parent47fd17cdc14a0d295a2cbdc02eff144e3fb4e900 (diff)
downloadgdb-35fb8261b95c07e548a0b03f60b6c2cebf83caf8.zip
gdb-35fb8261b95c07e548a0b03f60b6c2cebf83caf8.tar.gz
gdb-35fb8261b95c07e548a0b03f60b6c2cebf83caf8.tar.bz2
Style addresses
This changes gdb to style addresses. gdb/ChangeLog 2018-12-28 Tom Tromey <tom@tromey.com> * ui-out.h (enum class ui_out_style_kind) <ADDRESS>: New constant. * ui-out.c (ui_out::field_core_addr): Add styling. * stack.c (print_frame): Add styling. * printcmd.c (print_address): Add styling. (print_address_demangle, info_address_command): Likewise. * cli/cli-style.h (address_style): Declare. * cli/cli-style.c (address_style): New global. (_initialize_cli_style): Register new commands. * cli-out.c (cli_ui_out::do_field_string): Update. gdb/testsuite/ChangeLog 2018-12-28 Tom Tromey <tom@tromey.com> * gdb.base/style.exp: Update test to check for address styling.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index c5b6b1a..98f5b23 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -693,7 +693,7 @@ void
print_address (struct gdbarch *gdbarch,
CORE_ADDR addr, struct ui_file *stream)
{
- fputs_filtered (paddress (gdbarch, addr), stream);
+ fputs_styled (paddress (gdbarch, addr), address_style.style (), stream);
print_address_symbolic (gdbarch, addr, stream, asm_demangle, " ");
}
@@ -726,7 +726,7 @@ print_address_demangle (const struct value_print_options *opts,
{
if (opts->addressprint)
{
- fputs_filtered (paddress (gdbarch, addr), stream);
+ fputs_styled (paddress (gdbarch, addr), address_style.style (), stream);
print_address_symbolic (gdbarch, addr, stream, do_demangle, " ");
}
else
@@ -1404,14 +1404,17 @@ info_address_command (const char *exp, int from_tty)
fprintf_symbol_filtered (gdb_stdout, exp,
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is at ");
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
printf_filtered (" in a file compiled without debugging");
section = MSYMBOL_OBJ_SECTION (objfile, msymbol.minsym);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr),
+ address_style.style (),
+ gdb_stdout);
printf_filtered (" in overlay section %s",
section->the_bfd_section->name);
}
@@ -1451,12 +1454,14 @@ info_address_command (const char *exp, int from_tty)
case LOC_LABEL:
printf_filtered ("a label at address ");
load_addr = SYMBOL_VALUE_ADDRESS (sym);
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (",\n -- loaded at ");
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
printf_filtered (" in overlay section %s",
section->the_bfd_section->name);
}
@@ -1485,12 +1490,14 @@ info_address_command (const char *exp, int from_tty)
case LOC_STATIC:
printf_filtered (_("static storage at address "));
load_addr = SYMBOL_VALUE_ADDRESS (sym);
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
@@ -1522,12 +1529,14 @@ info_address_command (const char *exp, int from_tty)
case LOC_BLOCK:
printf_filtered (_("a function at address "));
load_addr = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
+ gdb_stdout);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}
@@ -1557,12 +1566,15 @@ info_address_command (const char *exp, int from_tty)
{
load_addr = BMSYMBOL_VALUE_ADDRESS (msym);
printf_filtered (_("static storage at address "));
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr),
+ address_style.style (), gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
printf_filtered (_(",\n -- loaded at "));
- fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
+ fputs_styled (paddress (gdbarch, load_addr),
+ address_style.style (),
+ gdb_stdout);
printf_filtered (_(" in overlay section %s"),
section->the_bfd_section->name);
}