aboutsummaryrefslogtreecommitdiff
path: root/target/avr/translate.c
diff options
context:
space:
mode:
authorMichael Rolnik <mrolnik@gmail.com>2020-01-24 01:51:16 +0100
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-07-11 11:02:05 +0200
commit9d8caa67a24ea4375a6dd110d8e7704acb1c8030 (patch)
tree0044f2e14fce0852cd73f2d3f24c2e4c9560c39f /target/avr/translate.c
parenta107fdb07264098295af806706001f62d39fdddd (diff)
downloadqemu-9d8caa67a24ea4375a6dd110d8e7704acb1c8030.zip
qemu-9d8caa67a24ea4375a6dd110d8e7704acb1c8030.tar.gz
qemu-9d8caa67a24ea4375a6dd110d8e7704acb1c8030.tar.bz2
target/avr: Add support for disassembling via option '-d in_asm'
Provide function disassembles executed instruction when '-d in_asm' is provided. Example: $ qemu-system-avr -bios free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf -d in_asm ... IN: 0x0000014a: CALL 0x3808 IN: main 0x00003808: CALL 0x4b4 IN: vParTestInitialise 0x000004b4: LDI r24, 255 0x000004b6: STS r24, 0 0x000004b8: MULS r16, r20 0x000004ba: OUT $1, r24 0x000004bc: LDS r24, 0 0x000004be: MULS r16, r20 0x000004c0: OUT $2, r24 0x000004c2: RET ... Suggested-by: Richard Henderson <richard.henderson@linaro.org> Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Suggested-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com> Signed-off-by: Michael Rolnik <mrolnik@gmail.com> [rth: Fix spacing and const mnemonic arrays] Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Aleksandar Markovic <aleksandar.m.mail@gmail.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Thomas Huth <huth@tuxfamily.org> Message-Id: <20200705140315.260514-19-huth@tuxfamily.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'target/avr/translate.c')
-rw-r--r--target/avr/translate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/avr/translate.c b/target/avr/translate.c
index 3d8a77e..648dcd5 100644
--- a/target/avr/translate.c
+++ b/target/avr/translate.c
@@ -3040,6 +3040,18 @@ done_generating:
tb->size = (ctx.npc - pc_start) * 2;
tb->icount = num_insns;
+
+#ifdef DEBUG_DISAS
+ if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)
+ && qemu_log_in_addr_range(tb->pc)) {
+ FILE *fd;
+ fd = qemu_log_lock();
+ qemu_log("IN: %s\n", lookup_symbol(tb->pc));
+ log_target_disas(cs, tb->pc, tb->size);
+ qemu_log("\n");
+ qemu_log_unlock(fd);
+ }
+#endif
}
void restore_state_to_opc(CPUAVRState *env, TranslationBlock *tb,