summaryrefslogtreecommitdiffstats
path: root/disas.c
diff options
context:
space:
mode:
authorAlex Bennée2020-05-13 19:51:32 +0200
committerAlex Bennée2020-05-15 16:25:16 +0200
commite5ef4ec28b801155e20fdb3a4cd21920ffc5f1af (patch)
tree43293a021a65ce37609a8a099af3230de37ecc1e /disas.c
parentaccel/tcg: don't disable exec_tb trace events (diff)
downloadqemu-e5ef4ec28b801155e20fdb3a4cd21920ffc5f1af.tar.gz
qemu-e5ef4ec28b801155e20fdb3a4cd21920ffc5f1af.tar.xz
qemu-e5ef4ec28b801155e20fdb3a4cd21920ffc5f1af.zip
disas: include an optional note for the start of disassembly
This will become useful shortly for providing more information about output assembly inline. While there fix up the indenting and code formatting in disas(). Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200513175134.19619-9-alex.bennee@linaro.org>
Diffstat (limited to 'disas.c')
-rw-r--r--disas.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/disas.c b/disas.c
index 3937da6157..7e8692de30 100644
--- a/disas.c
+++ b/disas.c
@@ -586,7 +586,7 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
}
/* Disassemble this for me please... (debugging). */
-void disas(FILE *out, void *code, unsigned long size)
+void disas(FILE *out, void *code, unsigned long size, const char *note)
{
uintptr_t pc;
int count;
@@ -674,10 +674,16 @@ void disas(FILE *out, void *code, unsigned long size)
for (pc = (uintptr_t)code; size > 0; pc += count, size -= count) {
fprintf(out, "0x%08" PRIxPTR ": ", pc);
count = print_insn(pc, &s.info);
- fprintf(out, "\n");
- if (count < 0)
- break;
+ if (note) {
+ fprintf(out, "\t\t%s", note);
+ note = NULL;
+ }
+ fprintf(out, "\n");
+ if (count < 0) {
+ break;
+ }
}
+
}
/* Look up symbol for debugging purpose. Returns "" if unknown. */