[PATCH 3/3] ntdll: fix up instruction pointer in context insideraise_exception

Dmitry Timoshkov dmitry at codeweavers.com
Mon Feb 19 02:37:05 CST 2007

"Peter Oberndorfer" <kumbayo84 at arcor.de> wrote:

> I'm not fully sure if the fixup also happens for other architectures
> (i guess not)
> so this patch is more a RFC

> @@ -336,6 +336,10 @@ static NTSTATUS raise_exception( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL f
>          if (status == DBG_CONTINUE || status == DBG_EXCEPTION_HANDLED)
>              return STATUS_SUCCESS;
> +        /* fix up instruction pointer in context for EXCEPTION_BREAKPOINT */
> +        if (rec->ExceptionCode == EXCEPTION_BREAKPOINT)
> +            GET_IP(context) = (DWORD_PTR)GET_IP(context) - 1;

Gary Nebbett's book "Windows Nt/2000 Native API Reference" in the section C
"Exceptions and Debugging" provides a pseudocode for KiDispatchException
(page 439, Example C.1), and it does exactly the same thing as the patch
above. *But* it does it as a very first thing after getting the context and
before sending the debugger event.


More information about the wine-devel mailing list