qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: deller@kernel.org, qemu-devel@nongnu.org
Cc: Helge Deller <deller@gmx.de>
Subject: Re: [PATCH v2 2/2] disas/hppa: Show hexcode of instruction along with disassembly
Date: Fri, 17 Nov 2023 08:45:21 -0800	[thread overview]
Message-ID: <6e256fa7-69eb-47de-a06b-f99d66318918@linaro.org> (raw)
In-Reply-To: <20231117105309.149225-3-deller@kernel.org>

On 11/17/23 02:53, deller@kernel.org wrote:
> From: Helge Deller <deller@gmx.de>
> 
> On hppa many instructions can be expressed by different bytecodes.
> To be able to debug qemu translation bugs it's therefore necessary to see the
> currently executed byte codes without the need to lookup the sequence without
> the full executable.
> With this patch the instruction byte code is shown beside the disassembly.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
>   disas/hppa.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/disas/hppa.c b/disas/hppa.c
> index dcf9a47f34..38fc05acc4 100644
> --- a/disas/hppa.c
> +++ b/disas/hppa.c
> @@ -1979,6 +1979,9 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
>   	  if (opcode->arch == pa20w)
>   	    continue;
>   #endif
> +	  (*info->fprintf_func) (info->stream, " %02x %02x %02x %02x   ",
> +                (insn >> 24) & 0xff, (insn >> 16) & 0xff,
> +                (insn >>  8) & 0xff, insn & 0xff);
>   	  (*info->fprintf_func) (info->stream, "%s", opcode->name);
>   
>   	  if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

A possible improvement is to push this outside of the search loop and then change

      }
-  (*info->fprintf_func) (info->stream, "#%8x", insn);
+  info->fprintf_func(info->stream, "<unknown>");
    return sizeof (insn);

so the byte decode is shared with the rare case of garbage in the insn stream.


r~


  reply	other threads:[~2023-11-17 16:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 10:53 [PATCH v2 0/2] HPPA64-PATCHES-for-8.2 deller
2023-11-17 10:53 ` [PATCH v2 1/2] target/hppa: Fix 64-bit SHRPD instruction deller
2023-11-17 16:42   ` Richard Henderson
2023-11-17 10:53 ` [PATCH v2 2/2] disas/hppa: Show hexcode of instruction along with disassembly deller
2023-11-17 16:45   ` Richard Henderson [this message]
2023-11-17 17:33     ` Helge Deller
2023-11-17 19:52       ` Richard Henderson

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=6e256fa7-69eb-47de-a06b-f99d66318918@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=deller@gmx.de \
    --cc=deller@kernel.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).