5

The QEMU -d asm_in and -d asm_out options are useful for examining the dynamically generated asm created by QEMU.

Unfortunately (for me) it defaults to AT&T syntax. Is there an option to output in Intel syntax?

2 Answers 2

5

No, QEMU doesn't provide a config option for choosing the disassembly syntax. (We use the binutils disassembler sources, so the code to output Intel syntax rather than AT&T is all there, but we don't wire it up to something the user can change.)

3

Thanks to Peter Maydell's answer we know that QEMU's disassembler is based on binutils. But binutils disassembler actually does support Intel syntax, we just need to know what to change to activate it. If you're willing to recompile QEMU, here's a patch which will force Intel syntax unconditionally:

diff --git a/disas/i386.c b/disas/i386.c
index f1e376c..4493115 100644
--- a/disas/i386.c
+++ b/disas/i386.c
@@ -3682,7 +3682,7 @@ static char scale_char;
 int
 print_insn_i386 (bfd_vma pc, disassemble_info *info)
 {
-  intel_syntax = -1;
+  intel_syntax = 1;

   return print_insn (pc, info);
 }
2
  • For the in_asm logging you would need to make a similar change to the disas() function in disas.c, and for disassembly via the QEMU monitor change monitor_disas(). Aug 18, 2017 at 12:25
  • @PeterMaydell actually I've realized that I just have to change one place to make Intel syntax apply to all the cases (at least in_asm and out_asm are now correct, not sure how to test QEMu monitor).
    – Ruslan
    Aug 18, 2017 at 13:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .