All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Gautam Bhat <mindentropy@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: Resources on deeper understanding of Translation blocks
Date: Mon, 15 May 2023 14:45:51 +0100	[thread overview]
Message-ID: <875y8tbt2y.fsf@linaro.org> (raw)
In-Reply-To: <CAM2a4uxjURNAUcMemWj+mJOvNjgHbXQ-KgiRdRghByM7pBVROw@mail.gmail.com>


Gautam Bhat <mindentropy@gmail.com> writes:

> Hi,
>
> I am going through some translation code for existing targets.
>
> I would like to know if there are any good resources on deeper
> understanding of translation blocks? Also some advice on the best way
> to read code related to translation in Qemu and trying it out maybe
> using the debugger, printing etc? I am getting lost trying to make
> sense of the translation code.

We have a section in the developers manual that gives an overview of the
translator and how it goes together:

  https://qemu.readthedocs.io/en/latest/devel/index-tcg.html

Generally for following code the best option is to use the debug flags,
the usual is:

 -d in_asm,op,op_opt,out_asm

which will dump in order:

  - in_asm, the guest instructions
  - op, the TCG ops they break down into
  - op_opt, the TCG ops after optimiation
  - out_asm, the host instructions for the block

as this is a lot of data you can limit to certain address ranges using
the -dfilter option.

Remember the above options will only dump the code as it is translated,
not each time the guest runs it.

You can attach to the guest using the gdbstub:

  https://qemu.readthedocs.io/en/latest/system/gdb.html

and stick a breakpoint at the code in question. If you have the HMP
monitor enabled you can then enable the debug options and single step
through the code and see each instruction translated and executed in
turn.


>
> Thanks,
> Gautam.


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2023-05-15 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-14 17:54 Resources on deeper understanding of Translation blocks Gautam Bhat
2023-05-15 13:45 ` Alex Bennée [this message]
2023-05-16 13:43   ` Gautam Bhat
2023-05-16 14:56     ` Alex Bennée
2023-05-16 15:34       ` Peter Maydell

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=875y8tbt2y.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=mindentropy@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.