Commit 4ee629a3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

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: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent dc3623f5
...@@ -199,6 +199,7 @@ BOOL WINAPI ContinueDebugEvent( ...@@ -199,6 +199,7 @@ BOOL WINAPI ContinueDebugEvent(
*/ */
BOOL WINAPI DebugActiveProcess( DWORD pid ) BOOL WINAPI DebugActiveProcess( DWORD pid )
{ {
HANDLE process;
BOOL ret; BOOL ret;
SERVER_START_REQ( debug_process ) SERVER_START_REQ( debug_process )
{ {
...@@ -207,6 +208,11 @@ BOOL WINAPI DebugActiveProcess( DWORD pid ) ...@@ -207,6 +208,11 @@ BOOL WINAPI DebugActiveProcess( DWORD pid )
ret = !wine_server_call_err( req ); ret = !wine_server_call_err( req );
} }
SERVER_END_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; return ret;
} }
......
...@@ -308,7 +308,6 @@ static void process_attach_events(struct debugger_context *ctx) ...@@ -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); 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 */ /* 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); ok(ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
if (ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT) if (ctx->ev.dwDebugEventCode == CREATE_THREAD_DEBUG_EVENT)
{ {
...@@ -320,7 +319,6 @@ static void process_attach_events(struct debugger_context *ctx) ...@@ -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.dwDebugEventCode == EXCEPTION_DEBUG_EVENT, "dwDebugEventCode = %d\n", ctx->ev.dwDebugEventCode);
ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n", ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode = %x\n",
ctx->ev.u.Exception.ExceptionRecord.ExceptionCode); ctx->ev.u.Exception.ExceptionRecord.ExceptionCode);
todo_wine
ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddres != DbgBreakPoint\n"); ok(ctx->ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddres != DbgBreakPoint\n");
/* flush debug events */ /* flush debug events */
......
...@@ -638,7 +638,6 @@ DECL_HANDLER(debug_process) ...@@ -638,7 +638,6 @@ DECL_HANDLER(debug_process)
else if (debugger_attach( process, current )) else if (debugger_attach( process, current ))
{ {
generate_startup_debug_events( process, 0 ); generate_startup_debug_events( process, 0 );
break_process( process );
resume_process( process ); resume_process( process );
} }
release_object( process ); release_object( process );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment