winedbg: Allow using 8-byte long hardware assisted breakpoints on x86_64 CPUs.

This commit is contained in:
Eric Pouech 2010-04-06 22:28:49 +02:00 committed by Alexandre Julliard
parent 2367186805
commit 5f23b94a27
3 changed files with 10 additions and 7 deletions

View File

@ -355,6 +355,7 @@ extern void be_x86_64_disasm_one_insn(ADDRESS64* addr, int display);
#define DR7_LEN_1 (0x0) #define DR7_LEN_1 (0x0)
#define DR7_LEN_2 (0x4) #define DR7_LEN_2 (0x4)
#define DR7_LEN_4 (0xC) #define DR7_LEN_4 (0xC)
#define DR7_LEN_8 (0x8)
#define DR7_LOCAL_ENABLE_SHIFT 0 #define DR7_LOCAL_ENABLE_SHIFT 0
#define DR7_GLOBAL_ENABLE_SHIFT 1 #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; *pr = (DWORD64)addr;
if (type != be_xpoint_watch_exec) switch (size) if (type != be_xpoint_watch_exec) switch (size)
{ {
case 8: bits |= DR7_LEN_8; break;
case 4: bits |= DR7_LEN_4; break; case 4: bits |= DR7_LEN_4; break;
case 2: bits |= DR7_LEN_2; break; case 2: bits |= DR7_LEN_2; break;
case 1: bits |= DR7_LEN_1; 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; *val = reg;
/* clear old values */ /* clear old values */

View File

@ -137,7 +137,7 @@ static int init_xpoint(int type, const ADDRESS64* addr)
* *
* Returns the value watched by watch point 'num'. * 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]; 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) switch (dbg_curr_process->bp[num].w.len + 1)
{ {
case 8: *val = *(DWORD64*)buf; break;
case 4: *val = *(DWORD*)buf; break; case 4: *val = *(DWORD*)buf; break;
case 2: *val = *(WORD*)buf; break; case 2: *val = *(WORD*)buf; break;
case 1: *val = *(BYTE*)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++) 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) && if (bp[i].refcount && bp[i].enabled && !is_xpoint_break(i) &&
(be_cpu->is_watchpoint_set(&dbg_context, bp[i].info))) (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++) 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) && if (bp[i].refcount && bp[i].enabled && !is_xpoint_break(i) &&
get_watched_value(i, &val)) get_watched_value(i, &val))
@ -740,8 +741,8 @@ BOOL break_should_continue(ADDRESS64* addr, DWORD code)
case be_xpoint_watch_write: case be_xpoint_watch_write:
dbg_printf("Stopped on watchpoint %d at ", dbg_curr_thread->stopped_xpoint); dbg_printf("Stopped on watchpoint %d at ", dbg_curr_thread->stopped_xpoint);
print_address(addr, TRUE); print_address(addr, TRUE);
dbg_printf(" new value %u\n", dbg_printf(" new value %s\n",
dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval); wine_dbgstr_longlong(dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval));
} }
return FALSE; return FALSE;
} }

View File

@ -139,7 +139,7 @@ struct dbg_breakpoint
struct /* only used for watchpoints */ struct /* only used for watchpoints */
{ {
BYTE len : 2; BYTE len : 2;
DWORD oldval; DWORD64 oldval;
} w; } w;
struct expr* condition; struct expr* condition;
}; };