[PATCH] Style more output of "disassemble" command
Gary Benson
gbenson@redhat.com
Mon Aug 10 14:25:17 GMT 2020
Tom Tromey wrote:
> I noticed a couple of spots where the "disassemble" could style its
> output, but currently does not. This patch adds styling to the
> function name at the start of the disassembly, and any addresses
> printed there.
...
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index e3965fea076..b70da4a0145 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -1397,12 +1397,16 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
> {
> printf_filtered ("Dump of assembler code ");
> if (name != NULL)
> - printf_filtered ("for function %s:\n", name);
> + printf_filtered ("for function %ps:\n",
> + styled_string (function_name_style.style (), name));
> if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
> {
> if (name == NULL)
> - printf_filtered ("from %s to %s:\n",
> - paddress (gdbarch, low), paddress (gdbarch, high));
> + printf_filtered ("from %ps to %ps:\n",
> + styled_string (address_style.style (),
> + paddress (gdbarch, low)),
> + styled_string (address_style.style (),
> + paddress (gdbarch, high)));
>
> /* Dump the specified range. */
> gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
> @@ -1413,9 +1417,11 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
> {
> CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
> CORE_ADDR range_high = BLOCK_RANGE_END (block, i);
> - printf_filtered (_("Address range %s to %s:\n"),
> - paddress (gdbarch, range_low),
> - paddress (gdbarch, range_high));
> + printf_filtered (_("Address range %ps to %ps:\n"),
> + styled_string (address_style.style (),
> + paddress (gdbarch, range_low)),
> + styled_string (address_style.style (),
> + paddress (gdbarch, range_high)));
> gdb_disassembly (gdbarch, current_uiout, flags, -1,
> range_low, range_high);
> }
Your patch looks good, but, as a consistency thing, does GDB have a
position w.r.t. gettext macros? Both these hunks are in the same
function, but only the second hunk's printf_filtered calls have _().
Thanks,
Gary
--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat
More information about the Gdb-patches
mailing list