[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;
+}
- [Qemu-devel] [PATCH v3 07/39] windbg: hook to wrmsr operation, (continued)
- [Qemu-devel] [PATCH v3 07/39] windbg: hook to wrmsr operation, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 08/39] windbg: implement windbg_on_load, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 09/39] windbg: implement find_KPCR, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 10/39] windbg: implement find_kdVersion, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 11/39] windbg: add windbg_search_vmaddr, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 12/39] windbg: implement find_kdDebuggerDataBlock, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 13/39] windbg: parsing data stream, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 14/39] windbg: send data and control packets, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 15/39] windbg: handler of parsing context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 16/39] windbg: init DBGKD_ANY_WAIT_STATE_CHANGE, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 17/39] windbg: generate ExceptionStateChange and LoadSymbolsStateChange,
Mikhail Abakumov <=
- [Qemu-devel] [PATCH v3 18/39] windbg: implement windbg_process_control_packet, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 19/39] windbg: implement windbg_process_data_packet, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 20/39] windbg: implement windbg_process_manipulate_packet, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 21/39] windbg: implement kd_api_read_virtual_memory and kd_api_write_virtual_memory, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 22/39] windbg: some kernel structures, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 23/39] windbg: add helper functions, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 24/39] windbg: [de]serialization cpu context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 25/39] windbg: [de]serialization cpu spec registers, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 26/39] windbg: implement kd_api_get_context and kd_api_set_context, Mikhail Abakumov, 2018/12/06
- [Qemu-devel] [PATCH v3 27/39] windbg: implement kd_api_get_context_ex and kd_api_set_context_ex, Mikhail Abakumov, 2018/12/06