qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 17/39] windbg: generate ExceptionStateChange and


From: Mikhail Abakumov
Subject: [Qemu-devel] [PATCH v3 17/39] windbg: generate ExceptionStateChange and LoadSymbolsStateChange
Date: Thu, 06 Dec 2018 15:00:14 +0300
User-agent: StGit/0.17.1-dirty

Signed-off-by: Mikhail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
 include/exec/windbgstub-utils.h |    3 +++
 target/i386/windbgstub.c        |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
index a28068eecd..794cb387b0 100644
--- a/include/exec/windbgstub-utils.h
+++ b/include/exec/windbgstub-utils.h
@@ -67,6 +67,9 @@ typedef struct PacketData {
 const char *kd_api_name(int id);
 const char *kd_pkt_type_name(int id);
 
+DBGKD_ANY_WAIT_STATE_CHANGE *kd_state_change_exc(CPUState *cs);
+DBGKD_ANY_WAIT_STATE_CHANGE *kd_state_change_ls(CPUState *cs);
+
 bool windbg_on_load(void);
 void windbg_on_reset(void);
 
diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c
index b2ac7a6d5f..37c5805818 100644
--- a/target/i386/windbgstub.c
+++ b/target/i386/windbgstub.c
@@ -161,7 +161,6 @@ void windbg_on_reset(void)
 #endif
 }
 
-__attribute__ ((unused)) /* unused yet */
 static void kd_init_state_change(CPUState *cs, DBGKD_ANY_WAIT_STATE_CHANGE *sc)
 {
     X86CPU *cpu = X86_CPU(cs);
@@ -201,3 +200,35 @@ static void kd_init_state_change(CPUState *cs, 
DBGKD_ANY_WAIT_STATE_CHANGE *sc)
     memset(cr->InstructionStream, 0, DBGKD_MAXSTREAM);
     stw_p(&cr->InstructionCount, 0);
 }
+
+DBGKD_ANY_WAIT_STATE_CHANGE *kd_state_change_exc(CPUState *cs)
+{
+    DBGKD_ANY_WAIT_STATE_CHANGE *sc = g_new0(DBGKD_ANY_WAIT_STATE_CHANGE, 1);
+    DBGKM_EXCEPTION_RECORD64 *exc = &sc->u.Exception.ExceptionRecord;
+    X86CPU *cpu = X86_CPU(cs);
+    CPUX86State *env = &cpu->env;
+
+    kd_init_state_change(cs, sc);
+
+    stl_p(&sc->NewState, DbgKdExceptionStateChange);
+    sttul_p(&exc->ExceptionAddress, env->eip);
+
+    /* TODO: Fix this hardcoded value. */
+    stl_p(&exc->ExceptionCode, 0x80000003);
+
+    return sc;
+}
+
+DBGKD_ANY_WAIT_STATE_CHANGE *kd_state_change_ls(CPUState *cs)
+{
+    DBGKD_ANY_WAIT_STATE_CHANGE *sc = g_new0(DBGKD_ANY_WAIT_STATE_CHANGE, 1);
+
+    kd_init_state_change(cs, sc);
+
+    stl_p(&sc->NewState, DbgKdLoadSymbolsStateChange);
+
+    /* TODO: Path to load symbold (with extra array). */
+    stl_p(&sc->u.LoadSymbols.PathNameLength, 0);
+
+    return sc;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]