Eric Pouech : winedbg: Allow using 8-byte long hardware assisted breakpoints on x86_64 CPUs.
Alexandre Julliard
julliard at winehq.org
Wed Apr 7 11:56:09 CDT 2010
Module: wine
Branch: master
Commit: 5f23b94a27eec0ad405682f4c16f54a78f370596
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5f23b94a27eec0ad405682f4c16f54a78f370596
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Tue Apr 6 22:28:49 2010 +0200
winedbg: Allow using 8-byte long hardware assisted breakpoints on x86_64 CPUs.
---
programs/winedbg/be_x86_64.c | 4 +++-
programs/winedbg/break.c | 11 ++++++-----
programs/winedbg/debugger.h | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index ac7f1fc..514310b 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -355,6 +355,7 @@ extern void be_x86_64_disasm_one_insn(ADDRESS64* addr, int display);
#define DR7_LEN_1 (0x0)
#define DR7_LEN_2 (0x4)
#define DR7_LEN_4 (0xC)
+#define DR7_LEN_8 (0x8)
#define DR7_LOCAL_ENABLE_SHIFT 0
#define DR7_GLOBAL_ENABLE_SHIFT 1
@@ -429,10 +430,11 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
*pr = (DWORD64)addr;
if (type != be_xpoint_watch_exec) switch (size)
{
+ case 8: bits |= DR7_LEN_8; break;
case 4: bits |= DR7_LEN_4; break;
case 2: bits |= DR7_LEN_2; break;
case 1: bits |= DR7_LEN_1; break;
- default: return 0;
+ default: WINE_FIXME("Unsupported xpoint_watch of size %d\n", size); return 0;
}
*val = reg;
/* clear old values */
diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c
index e72f2b6..e35250c 100644
--- a/programs/winedbg/break.c
+++ b/programs/winedbg/break.c
@@ -137,7 +137,7 @@ static int init_xpoint(int type, const ADDRESS64* addr)
*
* Returns the value watched by watch point 'num'.
*/
-static BOOL get_watched_value(int num, LPDWORD val)
+static BOOL get_watched_value(int num, DWORD64* val)
{
BYTE buf[4];
@@ -147,6 +147,7 @@ static BOOL get_watched_value(int num, LPDWORD val)
switch (dbg_curr_process->bp[num].w.len + 1)
{
+ case 8: *val = *(DWORD64*)buf; break;
case 4: *val = *(DWORD*)buf; break;
case 2: *val = *(WORD*)buf; break;
case 1: *val = *(BYTE*)buf; break;
@@ -554,7 +555,7 @@ static int find_triggered_watch(void)
*/
for (i = 0; i < dbg_curr_process->next_bp; i++)
{
- DWORD val = 0;
+ DWORD64 val = 0;
if (bp[i].refcount && bp[i].enabled && !is_xpoint_break(i) &&
(be_cpu->is_watchpoint_set(&dbg_context, bp[i].info)))
@@ -577,7 +578,7 @@ static int find_triggered_watch(void)
*/
for (i = 0; i < dbg_curr_process->next_bp; i++)
{
- DWORD val = 0;
+ DWORD64 val = 0;
if (bp[i].refcount && bp[i].enabled && !is_xpoint_break(i) &&
get_watched_value(i, &val))
@@ -740,8 +741,8 @@ BOOL break_should_continue(ADDRESS64* addr, DWORD code)
case be_xpoint_watch_write:
dbg_printf("Stopped on watchpoint %d at ", dbg_curr_thread->stopped_xpoint);
print_address(addr, TRUE);
- dbg_printf(" new value %u\n",
- dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval);
+ dbg_printf(" new value %s\n",
+ wine_dbgstr_longlong(dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval));
}
return FALSE;
}
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index 9d9c1b2..d8e1ef4 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -139,7 +139,7 @@ struct dbg_breakpoint
struct /* only used for watchpoints */
{
BYTE len : 2;
- DWORD oldval;
+ DWORD64 oldval;
} w;
struct expr* condition;
};
More information about the wine-cvs
mailing list