public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH 3/3] opcodes/i386: partially implement disassembler style support
Date: Thu, 17 Feb 2022 10:35:18 +0100	[thread overview]
Message-ID: <37ba6375-00cf-3041-ee79-21377558402c@suse.com> (raw)
In-Reply-To: <11996f886e69218629abf81f8041269e8740a60e.1645043588.git.aburgess@redhat.com>

On 16.02.2022 21:53, Andrew Burgess via Binutils wrote:
> @@ -9456,12 +9456,18 @@ print_insn (bfd_vma pc, instr_info *ins)
>  	{
>  	  name = prefix_name (ins, priv.the_buffer[0], priv.orig_sizeflag);
>  	  if (name != NULL)
> -	    (*ins->info->fprintf_func) (ins->info->stream, "%s", name);
> +	    (*ins->info->fprintf_styled_func)
> +	      (ins->info->stream, dis_style_mnemonic, "%s", name);
>  	  else
>  	    {
>  	      /* Just print the first byte as a .byte instruction.  */
> -	      (*ins->info->fprintf_func) (ins->info->stream, ".byte 0x%x",
> -				     (unsigned int) priv.the_buffer[0]);
> +	      (*ins->info->fprintf_styled_func)
> +		(ins->info->stream, dis_style_mnemonic, ".byte");

Perhaps better have dis_style_directive for this? It's certainly not
an insn mnemonic.

> +	      (*ins->info->fprintf_styled_func)
> +		(ins->info->stream, dis_style_text, " ");
> +	      (*ins->info->fprintf_styled_func)
> +		(ins->info->stream, dis_style_immediate, "0x%x",
> +		 (unsigned int) priv.the_buffer[0]);

I wonder if the naming (dis_style_immediate) isn't misleading. As per
the comment next to its definition it really appears to mean any kind
of number (like is the case here), not just immediate operands of
instructions. Hence maybe dis_style_number (as replacement for or in
addition to dis_style_immediate)?

> @@ -9497,10 +9503,15 @@ print_insn (bfd_vma pc, instr_info *ins)
>        /* Handle ins->prefixes before fwait.  */
>        for (i = 0; i < ins->fwait_prefix && ins->all_prefixes[i];
>  	   i++)
> -	(*ins->info->fprintf_func) (ins->info->stream, "%s ",
> -				    prefix_name (ins, ins->all_prefixes[i],
> -						 sizeflag));
> -      (*ins->info->fprintf_func) (ins->info->stream, "fwait");
> +	{
> +	  (*ins->info->fprintf_styled_func)
> +	    (ins->info->stream, dis_style_mnemonic, "%s",
> +	     prefix_name (ins, ins->all_prefixes[i], sizeflag));
> +	  (*ins->info->fprintf_styled_func)
> +	    (ins->info->stream, dis_style_mnemonic, " ");

Does the style matter for blanks? If so, why "mnemonic" here, but ...

> @@ -9744,13 +9759,17 @@ print_insn (bfd_vma pc, instr_info *ins)
>  	if (name == NULL)
>  	  abort ();
>  	prefix_length += strlen (name) + 1;
> -	(*ins->info->fprintf_func) (ins->info->stream, "%s ", name);
> +	(*ins->info->fprintf_styled_func)
> +	  (ins->info->stream, dis_style_mnemonic, "%s", name);
> +	(*ins->info->fprintf_styled_func)
> +	  (ins->info->stream, dis_style_text, " ");

... "text" here? If the style didn't matter, a single call (as it was
before) would seem to suffice in both cases.

Jan


  reply	other threads:[~2022-02-17  9:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 20:53 [PATCH 0/3] disassembler syntax highlighting in objdump (via libopcodes) Andrew Burgess
2022-02-16 20:53 ` [PATCH 1/3] objdump/opcodes: add syntax highlighting to disassembler output Andrew Burgess
2022-02-28 15:54   ` Tom Tromey
2022-02-16 20:53 ` [PATCH 2/3] opcodes/riscv: implement style support in the disassembler Andrew Burgess
2022-02-19 10:24   ` Andrew Burgess
2022-02-16 20:53 ` [PATCH 3/3] opcodes/i386: partially implement disassembler style support Andrew Burgess
2022-02-17  9:35   ` Jan Beulich [this message]
2022-02-17 16:15     ` Andrew Burgess
2022-02-17 16:29       ` Jan Beulich
2022-02-17 22:37         ` Andrew Burgess
2022-02-18  7:14           ` Jan Beulich
2022-02-19 10:54             ` Andrew Burgess
2022-02-21 13:08               ` Jan Beulich
2022-02-21 18:01                 ` Andrew Burgess
2022-02-17  3:57 ` [PATCH 0/3] disassembler syntax highlighting in objdump (via libopcodes) Nelson Chu
2022-02-17 16:17   ` Andrew Burgess
2022-03-21 14:33 ` [PATCHv2 " Andrew Burgess
2022-03-21 14:33   ` [PATCHv2 1/3] objdump/opcodes: add syntax highlighting to disassembler output Andrew Burgess
2022-03-21 14:33   ` [PATCHv2 2/3] opcodes/riscv: implement style support in the disassembler Andrew Burgess
2022-03-21 14:33   ` [PATCHv2 3/3] opcodes/i386: partially implement disassembler style support Andrew Burgess
2022-03-24 17:08   ` [PATCHv2 0/3] disassembler syntax highlighting in objdump (via libopcodes) Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37ba6375-00cf-3041-ee79-21377558402c@suse.com \
    --to=jbeulich@suse.com \
    --cc=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).