summary refs log tree commit diff stats
path: root/linux-user/i386/cpu_loop.c
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2022-10-24 22:18:09 +0200
committerLaurent Vivier <laurent@vivier.eu>2022-10-25 09:20:40 +0200
commitbd5ccd61080abf976a6a6cc2d09d31299bea0cee (patch)
tree3fce456ccb09b725ad1b32d7bfd7ab99a3529f0a /linux-user/i386/cpu_loop.c
parent35a2c85f7d691db7aa2c47181902ac87478eef7a (diff)
downloadfocaccia-qemu-bd5ccd61080abf976a6a6cc2d09d31299bea0cee.tar.gz
focaccia-qemu-bd5ccd61080abf976a6a6cc2d09d31299bea0cee.zip
linux-user: Add guest memory layout to exception dump
When the emulation stops with a hard exception it's very useful for
debugging purposes to dump the current guest memory layout (for an
example see /proc/self/maps) beside the CPU registers.

The open_self_maps() function provides such a memory dump, but since
it's located in the syscall.c file, various changes (add #includes, make
this function externally visible, ...) are needed to be able to call it
from the existing EXCP_DUMP() macro.

This patch takes another approach by re-defining EXCP_DUMP() to call
target_exception_dump(), which is in syscall.c, consolidates the log
print functions and allows to add the call to dump the memory layout.

Beside a reduced code footprint, this approach keeps the changes across
the various callers minimal, and keeps EXCP_DUMP() highlighted as
important macro/function.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <Y1bzAWbw07WBKPxw@p100>
[lv: remove pc declaration and setting]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/i386/cpu_loop.c')
-rw-r--r--linux-user/i386/cpu_loop.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/linux-user/i386/cpu_loop.c b/linux-user/i386/cpu_loop.c
index 42837399bc..865413c08f 100644
--- a/linux-user/i386/cpu_loop.c
+++ b/linux-user/i386/cpu_loop.c
@@ -201,7 +201,6 @@ void cpu_loop(CPUX86State *env)
 {
     CPUState *cs = env_cpu(env);
     int trapnr;
-    abi_ulong pc;
     abi_ulong ret;
 
     for(;;) {
@@ -307,9 +306,8 @@ void cpu_loop(CPUX86State *env)
             cpu_exec_step_atomic(cs);
             break;
         default:
-            pc = env->segs[R_CS].base + env->eip;
-            EXCP_DUMP(env, "qemu: 0x%08lx: unhandled CPU exception 0x%x - aborting\n",
-                      (long)pc, trapnr);
+            EXCP_DUMP(env, "qemu: unhandled CPU exception 0x%x - aborting\n",
+                      trapnr);
             abort();
         }
         process_pending_signals(env);