kernel32: Reimplement DebugBreakProcess on top of DbgUiIssueRemoteBreakin.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-07-05 13:21:37 +02:00 committed by Alexandre Julliard
parent 7f9faf10c7
commit a679f965c8
7 changed files with 8 additions and 73 deletions

View File

@ -407,21 +407,15 @@ void WINAPI DebugBreak(void)
* *
* True if successful. * True if successful.
*/ */
BOOL WINAPI DebugBreakProcess(HANDLE hProc) BOOL WINAPI DebugBreakProcess(HANDLE process)
{ {
BOOL ret, self; NTSTATUS status;
TRACE("(%p)\n", hProc); TRACE("(%p)\n", process);
SERVER_START_REQ( debug_break ) status = DbgUiIssueRemoteBreakin(process);
{ if (status) SetLastError(RtlNtStatusToDosError(status));
req->handle = wine_server_obj_handle( hProc ); return !status;
ret = !wine_server_call_err( req );
self = ret && reply->self;
}
SERVER_END_REQ;
if (self) DbgBreakPoint();
return ret;
} }

View File

@ -988,7 +988,6 @@ static void test_debug_children(char *name, DWORD flag, BOOL debug_child)
/* a new thread, which executes DbgDebugBreak, is created */ /* a new thread, which executes DbgDebugBreak, is created */
next_event(&ctx, 2000); next_event(&ctx, 2000);
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);
last_thread = ctx.ev.dwThreadId; last_thread = ctx.ev.dwThreadId;
@ -999,7 +998,7 @@ static void test_debug_children(char *name, DWORD flag, BOOL debug_child)
ok(ctx.ev.dwThreadId == last_thread, "unexpected thread\n"); ok(ctx.ev.dwThreadId == last_thread, "unexpected thread\n");
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 todo_wine_if(sizeof(void*) == 4)
ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddres != DbgBreakPoint\n"); ok(ctx.ev.u.Exception.ExceptionRecord.ExceptionAddress == pDbgBreakPoint, "ExceptionAddres != DbgBreakPoint\n");
ret = SetEvent(event_attach); ret = SetEvent(event_attach);

View File

@ -2552,20 +2552,6 @@ struct debug_process_reply
struct debug_break_request
{
struct request_header __header;
obj_handle_t handle;
};
struct debug_break_reply
{
struct reply_header __header;
int self;
char __pad_12[4];
};
struct set_debugger_kill_on_exit_request struct set_debugger_kill_on_exit_request
{ {
struct request_header __header; struct request_header __header;
@ -5901,7 +5887,6 @@ enum request
REQ_get_exception_status, REQ_get_exception_status,
REQ_continue_debug_event, REQ_continue_debug_event,
REQ_debug_process, REQ_debug_process,
REQ_debug_break,
REQ_set_debugger_kill_on_exit, REQ_set_debugger_kill_on_exit,
REQ_read_process_memory, REQ_read_process_memory,
REQ_write_process_memory, REQ_write_process_memory,
@ -6206,7 +6191,6 @@ union generic_request
struct get_exception_status_request get_exception_status_request; struct get_exception_status_request get_exception_status_request;
struct continue_debug_event_request continue_debug_event_request; struct continue_debug_event_request continue_debug_event_request;
struct debug_process_request debug_process_request; struct debug_process_request debug_process_request;
struct debug_break_request debug_break_request;
struct set_debugger_kill_on_exit_request set_debugger_kill_on_exit_request; struct set_debugger_kill_on_exit_request set_debugger_kill_on_exit_request;
struct read_process_memory_request read_process_memory_request; struct read_process_memory_request read_process_memory_request;
struct write_process_memory_request write_process_memory_request; struct write_process_memory_request write_process_memory_request;
@ -6509,7 +6493,6 @@ union generic_reply
struct get_exception_status_reply get_exception_status_reply; struct get_exception_status_reply get_exception_status_reply;
struct continue_debug_event_reply continue_debug_event_reply; struct continue_debug_event_reply continue_debug_event_reply;
struct debug_process_reply debug_process_reply; struct debug_process_reply debug_process_reply;
struct debug_break_reply debug_break_reply;
struct set_debugger_kill_on_exit_reply set_debugger_kill_on_exit_reply; struct set_debugger_kill_on_exit_reply set_debugger_kill_on_exit_reply;
struct read_process_memory_reply read_process_memory_reply; struct read_process_memory_reply read_process_memory_reply;
struct write_process_memory_reply write_process_memory_reply; struct write_process_memory_reply write_process_memory_reply;
@ -6708,6 +6691,6 @@ union generic_reply
struct resume_process_reply resume_process_reply; struct resume_process_reply resume_process_reply;
}; };
#define SERVER_PROTOCOL_VERSION 586 #define SERVER_PROTOCOL_VERSION 587
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -714,20 +714,6 @@ DECL_HANDLER(get_exception_status)
} }
} }
/* simulate a breakpoint in a process */
DECL_HANDLER(debug_break)
{
struct process *process;
reply->self = 0;
if ((process = get_process_from_handle( req->handle, PROCESS_SET_INFORMATION /*FIXME*/ )))
{
if (process != current->process) break_process( process );
else reply->self = 1;
release_object( process );
}
}
/* set debugger kill on exit flag */ /* set debugger kill on exit flag */
DECL_HANDLER(set_debugger_kill_on_exit) DECL_HANDLER(set_debugger_kill_on_exit)
{ {

View File

@ -1940,14 +1940,6 @@ enum char_info_mode
@END @END
/* Simulate a breakpoint in a process */
@REQ(debug_break)
obj_handle_t handle; /* process handle */
@REPLY
int self; /* was it the caller itself? */
@END
/* Set debugger kill on exit flag */ /* Set debugger kill on exit flag */
@REQ(set_debugger_kill_on_exit) @REQ(set_debugger_kill_on_exit)
int kill_on_exit; /* 0=detach/1=kill debuggee when debugger dies */ int kill_on_exit; /* 0=detach/1=kill debuggee when debugger dies */

View File

@ -213,7 +213,6 @@ DECL_HANDLER(queue_exception_event);
DECL_HANDLER(get_exception_status); DECL_HANDLER(get_exception_status);
DECL_HANDLER(continue_debug_event); DECL_HANDLER(continue_debug_event);
DECL_HANDLER(debug_process); DECL_HANDLER(debug_process);
DECL_HANDLER(debug_break);
DECL_HANDLER(set_debugger_kill_on_exit); DECL_HANDLER(set_debugger_kill_on_exit);
DECL_HANDLER(read_process_memory); DECL_HANDLER(read_process_memory);
DECL_HANDLER(write_process_memory); DECL_HANDLER(write_process_memory);
@ -517,7 +516,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_get_exception_status, (req_handler)req_get_exception_status,
(req_handler)req_continue_debug_event, (req_handler)req_continue_debug_event,
(req_handler)req_debug_process, (req_handler)req_debug_process,
(req_handler)req_debug_break,
(req_handler)req_set_debugger_kill_on_exit, (req_handler)req_set_debugger_kill_on_exit,
(req_handler)req_read_process_memory, (req_handler)req_read_process_memory,
(req_handler)req_write_process_memory, (req_handler)req_write_process_memory,
@ -1376,10 +1374,6 @@ C_ASSERT( sizeof(struct continue_debug_event_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct debug_process_request, pid) == 12 ); C_ASSERT( FIELD_OFFSET(struct debug_process_request, pid) == 12 );
C_ASSERT( FIELD_OFFSET(struct debug_process_request, attach) == 16 ); C_ASSERT( FIELD_OFFSET(struct debug_process_request, attach) == 16 );
C_ASSERT( sizeof(struct debug_process_request) == 24 ); C_ASSERT( sizeof(struct debug_process_request) == 24 );
C_ASSERT( FIELD_OFFSET(struct debug_break_request, handle) == 12 );
C_ASSERT( sizeof(struct debug_break_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct debug_break_reply, self) == 8 );
C_ASSERT( sizeof(struct debug_break_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct set_debugger_kill_on_exit_request, kill_on_exit) == 12 ); C_ASSERT( FIELD_OFFSET(struct set_debugger_kill_on_exit_request, kill_on_exit) == 12 );
C_ASSERT( sizeof(struct set_debugger_kill_on_exit_request) == 16 ); C_ASSERT( sizeof(struct set_debugger_kill_on_exit_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct read_process_memory_request, handle) == 12 ); C_ASSERT( FIELD_OFFSET(struct read_process_memory_request, handle) == 12 );

View File

@ -2447,16 +2447,6 @@ static void dump_debug_process_request( const struct debug_process_request *req
fprintf( stderr, ", attach=%d", req->attach ); fprintf( stderr, ", attach=%d", req->attach );
} }
static void dump_debug_break_request( const struct debug_break_request *req )
{
fprintf( stderr, " handle=%04x", req->handle );
}
static void dump_debug_break_reply( const struct debug_break_reply *req )
{
fprintf( stderr, " self=%d", req->self );
}
static void dump_set_debugger_kill_on_exit_request( const struct set_debugger_kill_on_exit_request *req ) static void dump_set_debugger_kill_on_exit_request( const struct set_debugger_kill_on_exit_request *req )
{ {
fprintf( stderr, " kill_on_exit=%d", req->kill_on_exit ); fprintf( stderr, " kill_on_exit=%d", req->kill_on_exit );
@ -4708,7 +4698,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_exception_status_request, (dump_func)dump_get_exception_status_request,
(dump_func)dump_continue_debug_event_request, (dump_func)dump_continue_debug_event_request,
(dump_func)dump_debug_process_request, (dump_func)dump_debug_process_request,
(dump_func)dump_debug_break_request,
(dump_func)dump_set_debugger_kill_on_exit_request, (dump_func)dump_set_debugger_kill_on_exit_request,
(dump_func)dump_read_process_memory_request, (dump_func)dump_read_process_memory_request,
(dump_func)dump_write_process_memory_request, (dump_func)dump_write_process_memory_request,
@ -5009,7 +4998,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_exception_status_reply, (dump_func)dump_get_exception_status_reply,
NULL, NULL,
NULL, NULL,
(dump_func)dump_debug_break_reply,
NULL, NULL,
(dump_func)dump_read_process_memory_reply, (dump_func)dump_read_process_memory_reply,
NULL, NULL,
@ -5310,7 +5298,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_exception_status", "get_exception_status",
"continue_debug_event", "continue_debug_event",
"debug_process", "debug_process",
"debug_break",
"set_debugger_kill_on_exit", "set_debugger_kill_on_exit",
"read_process_memory", "read_process_memory",
"write_process_memory", "write_process_memory",