Jacek Caban : kernel32: Use DebugBreakProcess in DebugActiveProcess.
Alexandre Julliard
julliard at winehq.org
Fri Jul 5 14:49:18 CDT 2019
Module: wine
Branch: master
Commit: 4ee629a3bafb1408a4e567908fef949837a39f10
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4ee629a3bafb1408a4e567908fef949837a39f10
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Jul 5 13:24:14 2019 +0200
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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/debugger.c | 6 ++++++
dlls/kernel32/tests/debugger.c | 2 --
server/debugger.c | 1 -
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c
index d439475..d78b083 100644
--- a/dlls/kernel32/debugger.c
+++ b/dlls/kernel32/debugger.c
@@ -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;
}
diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index ff25c21..bc12ea8 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -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 */
diff --git a/server/debugger.c b/server/debugger.c
index 7c64cbb..99e50aa 100644
--- a/server/debugger.c
+++ b/server/debugger.c
@@ -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 );
More information about the wine-cvs
mailing list