From 394a36c25a143bb34627ec2bb13b12b7042fef98 Mon Sep 17 00:00:00 2001 From: Peter Oberndorfer Date: Tue, 22 May 2007 18:28:55 +0200 Subject: [PATCH] winedbg: Only check for break/watch points on first chance exceptions. --- programs/winedbg/break.c | 11 +++++++++-- programs/winedbg/debugger.h | 2 +- programs/winedbg/tgt_active.c | 13 ++++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 4c1e3fedc62..be6e6c53e31 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -775,15 +775,22 @@ BOOL break_should_continue(ADDRESS64* addr, DWORD code) } /*********************************************************************** - * break_ajust_pc + * break_adjust_pc * * Adjust PC to the address where the trap (if any) actually occurred * Also sets dbg_curr_thread->stopped_xpoint */ -void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL* is_break) +void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_break) { DWORD oldval = 0; + /* break / watch points are handled on first chance */ + if ( !first_chance ) + { + *is_break = TRUE; + dbg_curr_thread->stopped_xpoint = -1; + return; + } *is_break = FALSE; /* If not single-stepping, back up to the break instruction */ diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index e09d5f3db34..556bc08a6ed 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -288,7 +288,7 @@ extern void break_delete_xpoint(int num); extern void break_delete_xpoints_from_module(unsigned long base); extern void break_enable_xpoint(int num, BOOL enable); extern void break_info(void); -extern void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL* is_break); +extern void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_break); extern BOOL break_should_continue(ADDRESS64* addr, DWORD code); extern void break_suspend_execution(void); extern void break_restart_execution(int count); diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 16982011b92..348895de688 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -107,7 +107,14 @@ static unsigned dbg_fetch_context(void) return TRUE; } -static unsigned dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec) +/*********************************************************************** + * dbg_exception_prolog + * + * Examine exception and decide if interactive mode is entered(return TRUE) + * or exception is silently continued(return FALSE) + * is_debug means the exception is a breakpoint or single step exception + */ +static unsigned dbg_exception_prolog(BOOL is_debug, BOOL first_chance, const EXCEPTION_RECORD* rec) { ADDRESS64 addr; BOOL is_break; @@ -143,7 +150,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec) /* this will resynchronize builtin dbghelp's internal ELF module list */ SymLoadModule(dbg_curr_process->handle, 0, 0, 0, 0, 0); - if (is_debug) break_adjust_pc(&addr, rec->ExceptionCode, &is_break); + if (is_debug) break_adjust_pc(&addr, rec->ExceptionCode, first_chance, &is_break); /* * Do a quiet backtrace so that we have an idea of what the situation * is WRT the source files. @@ -398,7 +405,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance dbg_printf( ", invalid program stack" ); } - if (dbg_exception_prolog(is_debug, rec)) + if (dbg_exception_prolog(is_debug, first_chance, rec)) { dbg_interactiveP = TRUE; return 0;