kernel32: Use DebugBreakProcess in DebugActiveProcess.

Fixes attaching to a process with VS remote debugger. It expects the
first break exception address to be DbgBreakPoint.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Jacek Caban 2019-07-05 13:24:14 +02:00 committed by Alexandre Julliard
parent dc3623f57f
commit 4ee629a3ba
3 changed files with 6 additions and 3 deletions

View File

@ -199,6 +199,7 @@ BOOL WINAPI ContinueDebugEvent(
*/
BOOL WINAPI DebugActiveProcess( DWORD pid )
{
HANDLE process;
BOOL ret;
SERVER_START_REQ( debug_process )
{
@ -207,6 +208,11 @@ BOOL WINAPI DebugActiveProcess( DWORD pid )
ret = !wine_server_call_err( req );
}
SERVER_END_REQ;
if (!ret) return FALSE;
if (!(process = OpenProcess( PROCESS_CREATE_THREAD, FALSE, pid ))) return FALSE;
ret = DebugBreakProcess( process );
NtClose( process );
if (!ret) DebugActiveProcessStop( pid );
return ret;
}

View File

@ -308,7 +308,6 @@ static void process_attach_events(struct debugger_context *ctx)
ok(ctx->dll_cnt > 2, "dll_cnt = %d\n", ctx->dll_cnt);
/* a new thread is created and it executes DbgBreakPoint, which causes the exception */
todo_wine
ok(ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
if (ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT)
{
@ -320,7 +319,6 @@ static void process_attach_events(struct debugger_context *ctx)
ok(ctx->ev.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
todo_wine
ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddres != DbgBreakPoint\n");
/* flush debug events */

View File

@ -638,7 +638,6 @@ DECL_HANDLER(debug_process)
else if (debugger_attach( process, current ))
{
generate_startup_debug_events( process, 0 );
break_process( process );
resume_process( process );
}
release_object( process );