qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resources on deeper understanding of Translation blocks


From: Alex Bennée
Subject: Re: Resources on deeper understanding of Translation blocks
Date: Mon, 15 May 2023 14:45:51 +0100
User-agent: mu4e 1.11.6; emacs 29.0.91

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 via email to

[Prev in Thread] Current Thread [Next in Thread]