Patchwork [2/4] Improve Monitor disas with symbol lookup

login
register
mail settings
Submitter Fabien Chouteau
Date Oct. 4, 2013, 4:57 p.m.
Message ID <1380905823-3981-3-git-send-email-chouteau@adacore.com>
Download mbox | patch
Permalink /patch/280678/
State New
Headers show

Comments

Fabien Chouteau - Oct. 4, 2013, 4:57 p.m.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 disas.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/disas.c b/disas.c
index 32407de..c83bf5b 100644
--- a/disas.c
+++ b/disas.c
@@ -507,7 +507,15 @@  void monitor_disas(Monitor *mon, CPUArchState *env,
 #endif
 
     for (i = 0; i < nb_insn; i++) {
-        monitor_printf(mon, "0x" TARGET_FMT_lx ":  ", pc);
+        const char *sym = lookup_symbol(pc);
+
+        monitor_printf(mon, "0x" TARGET_FMT_lx, pc);
+        if (sym[0] != '\0') {
+            monitor_printf(mon, " <%s>:  ", sym);
+        } else {
+            monitor_printf(mon, ":  ");
+        }
+
         count = print_insn(pc, &s.info);
         monitor_printf(mon, "\n");
         if (count < 0) {