[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 32/46] windbg: implemented windbg_hw_breakpoint_i
From: |
Mihail Abakumov |
Subject: |
[Qemu-devel] [PATCH v4 32/46] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove |
Date: |
Mon, 11 Dec 2017 16:24:22 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Mihail Abakumov <address@hidden>
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Dmitriy Koltunov <address@hidden>
---
target/i386/windbgstub.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/target/i386/windbgstub.c b/target/i386/windbgstub.c
index 6e167a7473..5e094e81d7 100755
--- a/target/i386/windbgstub.c
+++ b/target/i386/windbgstub.c
@@ -290,11 +290,67 @@ typedef struct _CPU_KPROCESSOR_STATE {
static int windbg_hw_breakpoint_insert(CPUState *cpu, int index)
{
+ CPUArchState *env = cpu->env_ptr;
+
+ target_ulong addr = env->dr[index];
+ int type = BP_TYPE(env->dr[7], index);
+ int len = BP_LEN(env->dr[7], index);
+ int err = 0;
+
+ switch (type) {
+ case DR7_TYPE_DATA_WR:
+ err = cpu_watchpoint_insert(cpu, addr, len, BP_MEM_WRITE | BP_GDB,
+ &env->cpu_watchpoint[index]);
+ break;
+ case DR7_TYPE_DATA_RW:
+ err = cpu_watchpoint_insert(cpu, addr, len, BP_MEM_ACCESS | BP_GDB,
+ &env->cpu_watchpoint[index]);
+ break;
+ case DR7_TYPE_BP_INST:
+ err = cpu_breakpoint_insert(cpu, addr, BP_GDB,
+ &env->cpu_breakpoint[index]);
+ break;
+ case DR7_TYPE_IO_RW:
+ return HF_IOBPT_MASK;
+ default:
+ return 0;
+ }
+
+ if (!err) {
+ WINDBG_DEBUG("hw_breakpoint_insert: index(%d), " FMT_ADDR,
+ index, addr);
+ } else {
+ env->cpu_breakpoint[index] = NULL;
+ WINDBG_ERROR("hw_breakpoint_insert: index(%d), " FMT_ADDR ", " FMT_ERR,
+ index, addr, err);
+ }
return 0;
}
static int windbg_hw_breakpoint_remove(CPUState *cpu, int index)
{
+ CPUArchState *env = cpu->env_ptr;
+ int type = BP_TYPE(env->dr[7], index);
+
+ switch (type) {
+ case DR7_TYPE_BP_INST:
+ if (env->cpu_breakpoint[index]) {
+ cpu_breakpoint_remove_by_ref(cpu, env->cpu_breakpoint[index]);
+ }
+ break;
+ case DR7_TYPE_DATA_WR:
+ case DR7_TYPE_DATA_RW:
+ if (env->cpu_watchpoint[index]) {
+ cpu_watchpoint_remove_by_ref(cpu, env->cpu_watchpoint[index]);
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ env->cpu_breakpoint[index] = NULL;
+ WINDBG_DEBUG("hw_breakpoint_remove: index(%d), " FMT_ADDR,
+ index, env->dr[index]);
return 0;
}
- [Qemu-devel] [PATCH v4 22/46] windbg: kernel's structures, (continued)
- [Qemu-devel] [PATCH v4 22/46] windbg: kernel's structures, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 23/46] windbg: implemented kd_api_get_context and kd_api_set_context, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 24/46] windbg: implemented kd_api_read_control_space and kd_api_write_control_space, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 25/46] windbg: implemented windbg_read_context, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 26/46] windbg: implemented windbg_write_context, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 28/46] windbg: implemented windbg_write_ks_regs, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 27/46] windbg: implemented windbg_read_ks_regs, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 29/46] windbg: implemented windbg_set_sr, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 30/46] windbg: implemented windbg_set_dr, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 31/46] windbg: implemented windbg_set_dr7, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 32/46] windbg: implemented windbg_hw_breakpoint_insert and windbg_hw_breakpoint_remove,
Mihail Abakumov <=
- [Qemu-devel] [PATCH v4 33/46] windbg: implemented kd_api_write_breakpoint and kd_api_restore_breakpoint, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 34/46] windbg: debug exception subscribing, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 35/46] windbg: implemented kd_api_continue, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 36/46] windbg: implemented kd_api_read_io_space and kd_api_write_io_space, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 37/46] windbg: implemented kd_api_read_physical_memory and kd_api_write_physical_memory, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 38/46] windbg: implemented kd_api_get_version, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 39/46] windbg: implemented kd_api_read_msr and kd_api_write_msr, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 40/46] windbg: implemented kd_api_search_memory, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 41/46] windbg: implemented kd_api_fill_memory, Mihail Abakumov, 2017/12/11
- [Qemu-devel] [PATCH v4 42/46] windbg: implemented kd_api_query_memory, Mihail Abakumov, 2017/12/11